コマンドラインで GitHub を利用するためのツール GitHub CLI の gh repo list コマンドで GitHub のリポジトリの情報を表示します。
初回に gh コマンドを実行する前に必要な、gh auth login コマンドによる GitHub CLI ツールの GitHub アカウントを用いた認証の手順についても紹介します。

※ GitHub CLI バージョン 2.78.0 を使用します。
GitHub CLI の導入
gh コマンドを使えるようにする GitHub CLI ツールを Windows 10 に導入する手順については以下の記事を参照してください。
リポジトリ管理コマンドの説明の表示
リポジトリ管理に関するコマンド gh repo の使用方法は、コマンドプロンプトで gh repo⏎ と入力すると表示されます。
※ Windows 10 の場合、デスクトップ左下の検索ボックスで cmd⏎ と入力するとコマンドプロンプトを起動できます。
※ gh⏎ で repo などのコマンドの使用方法を確認できます。
C:\>gh repo
Work with GitHub repositories.
USAGE
gh repo <command> [flags]
GENERAL COMMANDS
create: Create a new repository
list: List repositories owned by user or organization
TARGETED COMMANDS
archive: Archive a repository
autolink: Manage autolink references
clone: Clone a repository locally
delete: Delete a repository
deploy-key: Manage deploy keys in a repository
edit: Edit repository settings
fork: Create a fork of a repository
gitignore: List and view available repository gitignore templates
license: Explore repository licenses
rename: Rename a repository
set-default: Configure default repository for this directory
sync: Sync a repository
unarchive: Unarchive a repository
view: View a repository
INHERITED FLAGS
--help Show help for command
ARGUMENTS
A repository can be supplied as an argument in any of the following formats:
- "OWNER/REPO"
- by URL, e.g. "https://github.com/OWNER/REPO"
EXAMPLES
$ gh repo create
$ gh repo clone cli/cli
$ gh repo view --web
LEARN MORE
Use `gh <command> <subcommand> --help` for more information about a command.
Read the manual at https://cli.github.com/manual
Learn about exit codes using `gh help exit-codes`
Learn about accessibility experiences using `gh help accessibility`最初はアカウント認証が必要
GitHub CLI ツールの gh コマンドで、GitHub を利用する場合、 GitHub アカウントによる認証が必要です。
認証をする前に gh repo list コマンドを入力すると、以下のように GitHub アカウントによる認証を行うコマンドの案内が表示されます。
C:\>gh repo list
To get started with GitHub CLI, please run: gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.指示されたように
gh auth login
を実行します。
GitHub.com を利用するか、他を利用するかの選択肢が出るので、 GitHub.com を選択した状態で Enter キーを押します。
※↑↓キーで選択できます。

通信プロトコルを HTTPS, SSH から選択して Enter キーを押します。
※例では HTTPS を選択しました。

以下の認証に関する質問では (Y/n) とあったので y⏎ と入力しました。
Authenticate Git with your GitHub credentials?
GitHub 資格情報を使用して Git を認証しますか?
ログイン方法を選択して Enter キーを押します。
※例では、ウェブブラウザを選択しました。

指定された URL (https://github.com/login/device) をコピーして、ウェブブラウザでアクセスします。

! First copy your one-time code: 2???-???F
Press Enter to open https://github.com/login/device in your browser…

URL を開いたウェブブラウザで、ログイン認証する GitHub アカウントの枠内の Continue ボタンを押します。

コマンドプロンプトに表示されている one-time code をコピーします。

コピーしたワンタイムコードをウェブブラウザの Device Activation のページで貼り付けて Continue ボタンを押します。

GitHub CLI に GitHub アカウントで許可する権限を確認して、問題がなければ Authorize github ボタンを押します。

権限の内容は、各セクションの▽リンクを押すと確認できます。
以下は、各セクションの▽リンクを開いた状態でコピーしたテキストです。
Authorize GitHub CLI
This authorization was requested from 地名と IP アドレス on September 5th, 2025 at 17:29 (JST)
Make sure you trust this device as it will get access to your account.
@sakura-crowdGitHub CLI by GitHub
wants to access your sakura-crowd account
Gists
Read and write access
This application will be able to read and write your public and secret gists.
Learn more
Organizations and teams
Read-only access
This application will be able to read your organization, team membership, and private project boards.
Learn more
Repositories
Public and private
This application will be able to read and write all public and private repository data. This includes the following:
Code
Issues
Pull requests
Wikis
Settings
Webhooks and services
Deploy keys
Collaboration invites
Note: In addition to repository related resources, the repo scope also grants access to manage organization attributes and organization-owned resources including projects, invitations, team memberships and webhooks. This scope also grants the ability to manage projects owned by users.
Learn more
Workflow
Update GitHub Action Workflow files.
This application will be able to remove, edit GitHub Action Workflow files for your repositories.
Learn more
Requested from 地名と IP アドレス on September 5th, 2025 at 17:29 (JST)GitHub アカウントのパスワードを入力して confirm ボタンを押します。

GitHub CLI が GitHub アカウントを利用するためのログイン認証が完了しました。

コマンドプロンプトに戻り、 Enter キーを押します。

GitHub CLI の gh auth login コマンドを実行したコマンドプロンプトにも、選択した GitHub アカウントでログインしたことについてのメッセージが表示されました。

C:\>gh repo list
To get started with GitHub CLI, please run: gh auth login
Alternatively, populate the GH_TOKEN environment variable with a GitHub API authentication token.
C:\>gh auth login
? Where do you use GitHub? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: 2???-???F
Press Enter to open https://github.com/login/device in your browser...
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as sakura-crowd
C:\>自身の GitHub アカウントのリポジトリの一覧の表示
gh auto login による GitHub アカウント認証後に、 gh repo list⏎ とコマンドプロンプトで入力すると、自身のアカウントのリポジトリの一覧が表示されました。
※認証を一度した後に、別に起動したコマンドプロンプトで gh repo list コマンドを実行すると、認証は求められずにすぐにリポジトリの一覧が表示されました。

C:\>gh repo list
Showing 13 of 13 repositories in @sakura-crowd
NAME DESCRIPTION INFO UPDATED
sakura-crowd/Gut Git サブモジュールとして Godot4 プロジェク... public, fork about 1 month ago
sakura-crowd/SakuraCrowdGodotLib Programs and assets for GodotEngine4 creat... public about 1 month ago
sakura-crowd/WebGLPublic WebGL アプリをサブフォルダでそれぞれ公開す... public about 1 year ago
sakura-crowd/Unity Unity(2021.3.14) 用の自作スクリプト群です... public about 2 years ago
sakura-crowd/TopDownEngineExtension Unity TopDown Engine に依存した拡張プログ... public about 2 years ago
sakura-crowd/ScImageShiftOverlayForUnity 画像パーツごとにオフセット(位置、角度)を指... public about 4 years ago
sakura-crowd/HSP HSPのコード public about 4 years ago
sakura-crowd/scSpiralStar-JS- らせん状に移動する星とポインタを追尾する円... public about 6 years ago
sakura-crowd/ScImageConvertByGA 教師データとして与えられた2値画像を遺伝的... public about 6 years ago
sakura-crowd/SCAnima2DHelper Unity の Anima2D を使う際に補助するための... public about 7 years ago
sakura-crowd/iap_blockkuzushi Unity と itemstore パッケージで作成したア... public about 7 years ago
sakura-crowd/sample_blockkuzushi Unity で作ったブロック崩しです。 itemstore... public about 7 years ago
sakura-crowd/RMMV RPG Maker MV Plugins (personal work) public about 8 years ago
まとめ
- GitHub CLI の gh コマンドで GitHub の情報を得るには、 GitHub アカウントの認証が必要です。
- 認証後に起動したコマンドプロンプトで再び gh コマンドを実行した際には、認証は必要ありませんでした。
- GitHub アカウントの認証は gh auth login コマンドを実行します。
- GitHub の自身のアカウントのリポジトリの一覧は gh repo list コマンドで表示できます。
参照サイト Thank You!
記事一覧 → Compota-Soft-Press

コメント