gh-cli-setup
GitHub CLI(gh コマンド)がインストールされていない、設定が済んでいない、認証に失敗した場合に、インストール手順や認証方法、トラブルシューティングを案内し、GitHubをスムーズに利用開始できるように支援するSkill。
📜 元の英語説明(参考)
Use when gh CLI is not installed, not configured, or authentication fails - provides installation steps, authentication methods, and troubleshooting for all platforms
🇯🇵 日本人クリエイター向け解説
GitHub CLI(gh コマンド)がインストールされていない、設定が済んでいない、認証に失敗した場合に、インストール手順や認証方法、トラブルシューティングを案内し、GitHubをスムーズに利用開始できるように支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o gh-cli-setup.zip https://jpskill.com/download/8592.zip && unzip -o gh-cli-setup.zip && rm gh-cli-setup.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8592.zip -OutFile "$d\gh-cli-setup.zip"; Expand-Archive "$d\gh-cli-setup.zip" -DestinationPath $d -Force; ri "$d\gh-cli-setup.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
gh-cli-setup.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
gh-cli-setupフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
GitHub CLI のセットアップとトラブルシューティング
概要
このスキルは、GitHub CLI (gh) のインストール、設定、および認証に関する問題を診断し、修正するのに役立ちます。
重要: インストール手順を提供する際は、常に以下を行ってください。
- 推奨される方法を説明する (例: "Homebrew は macOS にインストールする推奨の方法です")
- 実際のコマンドを提供する
- 代替のインストール方法について言及する
- コマンドが何をするのかについて説明を加える
- 説明なしに生のコマンドだけを返さない
どのような時に使うか
このスキルは、以下の場合に使用してください。
ghコマンドが見つからない- 認証エラーが発生する
- gh CLI が予期しない動作をする
- gh CLI の設定を確認する必要がある
- gh CLI を初めてセットアップする
クイック診断
以下のコマンドを実行して、ステータスを確認します。
# gh がインストールされているか確認
which gh
# gh のバージョンを確認
gh --version
# 認証ステータスを確認
gh auth status
# 認証済みアカウントを一覧表示
gh auth status --show-token
インストール
macOS
Homebrew を使用 (推奨):
brew install gh
MacPorts を使用:
sudo port install gh
Conda を使用:
conda install gh --channel conda-forge
Linux
Debian/Ubuntu/Raspbian:
# GitHub CLI リポジトリを追加
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# インストール
sudo apt update
sudo apt install gh -y
Fedora/CentOS/RHEL:
sudo dnf install gh
Arch Linux:
sudo pacman -S github-cli
Snap を使用:
sudo snap install gh
Conda を使用:
conda install gh --channel conda-forge
Windows
WinGet を使用:
winget install --id GitHub.cli
Scoop を使用:
scoop install gh
Chocolatey を使用:
choco install gh
Conda を使用:
conda install gh --channel conda-forge
手動ダウンロード:
- MSI インストーラーを以下からダウンロード: https://cli.github.com/
認証
インタラクティブ認証 (推奨)
gh auth login
これにより、以下のプロンプトが表示されます。
- GitHub.com または GitHub Enterprise Server を選択
- 認証方法を選択 (Web ブラウザまたはトークン)
- 認証フローを完了
トークン認証
# トークンを以下で作成: https://github.com/settings/tokens
# 必要なスコープ: repo, read:org, workflow
# トークンで認証
gh auth login --with-token < token.txt
# または、プロンプトが表示されたらトークンを貼り付け
gh auth login
認証の確認
# 認証ステータスを確認
gh auth status
# 認証済みユーザーを表示
gh api user --jq '.login'
# API アクセスをテスト
gh api rate_limit
よくあるエラーと解決策
エラー: "gh: command not found"
原因: gh CLI がインストールされていないか、PATH にない
解決策:
# gh がインストールされているか確認
which gh
# 見つからない場合は、インストール (上記のインストールセクションを参照)
# インストールされているが PATH にない場合は、PATH に追加
# bash/zsh の場合、~/.bashrc または ~/.zshrc に以下を追加:
export PATH="/path/to/gh/bin:$PATH"
エラー: "authentication required"
原因: GitHub にログインしていない
解決策:
# インタラクティブにログイン
gh auth login
# または、認証ステータスを確認
gh auth status
エラー: "HTTP 403: Resource not accessible by integration"
原因: トークンの権限が不十分
解決策:
# 適切なスコープで再認証
gh auth login --scopes repo,read:org,workflow
# または、必要なスコープで新しいトークンを作成:
# https://github.com/settings/tokens
エラー: "HTTP 401: Bad credentials"
原因: トークンの有効期限が切れているか、無効
解決策:
# ログアウトして再認証
gh auth logout
gh auth login
エラー: "API rate limit exceeded"
原因: API リクエストが多すぎる (認証なしで 60/時間、認証ありで 5000/時間)
解決策:
# レート制限ステータスを確認
gh api rate_limit
# より高い制限を得るために認証 (まだ認証していない場合)
gh auth login
# レート制限のリセットを待つか、別のアカウントを使用
エラー: "Could not resolve host: github.com"
原因: ネットワーク接続の問題
解決策:
# インターネット接続を確認
ping github.com
# 企業ファイアウォールの背後にいる場合は、プロキシ設定を確認
gh config set http_proxy http://proxy.example.com:8080
# DNS 解決を確認
nslookup github.com
設定
設定の表示
# すべての設定を表示
gh config list
# 特定の設定を表示
gh config get git_protocol
一般的な設定
# デフォルトのプロトコルを設定 (https または ssh)
gh config set git_protocol https
# デフォルトのエディタを設定
gh config set editor vim
# デフォルトのブラウザを設定
gh config set browser firefox
# プロキシを設定
gh config set http_proxy http://proxy.example.com:8080
# GitHub Enterprise ホストを設定
gh config set host github.enterprise.com
設定ファイルの場所
- Linux/macOS:
~/.config/gh/config.yml - Windows:
%AppData%\GitHub CLI\config.yml
複数のアカウント
# 複数のホストにログイン
gh auth login --hostname github.com
gh auth login --hostname github.enterprise.com
# アカウントを切り替え
gh auth switch
# どのアカウントがアクティブか確認
gh auth status
デバッグ
デバッグモードを有効にする
# デバッグ出力を伴うコマンドを実行
GH_DEBUG=api gh search repos "test"
# または、すべてのコマンドに対して
export GH_DEBUG=api
リクエスト/レスポンスの表示
# HTTP リクエストとレスポンスを表示
gh api repos/owner/repo --verbose
バージョンの確認
# gh のバージョンを表示
gh --version
# 更新を確認
gh extension upgrade --all
トラブルシューティングチェックリスト
gh CLI が動作しない場合は、以下の順序で確認してください。
- [ ] gh はインストールされていますか? (
which gh) - [ ] Is g
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
GitHub CLI Setup & Troubleshooting
Overview
This skill helps diagnose and fix GitHub CLI (gh) installation, configuration, and authentication issues.
IMPORTANT: When providing installation instructions, always:
- Explain the recommended method (e.g., "Homebrew is the recommended way to install on macOS")
- Provide the actual command
- Mention alternative installation methods
- Add context about what the command does
- Do NOT just return a bare command without explanation
When to Use
Use this skill when:
ghcommand not found- Authentication errors occur
- gh CLI behaves unexpectedly
- Need to check gh CLI configuration
- Setting up gh CLI for first time
Quick Diagnostic
Run these commands to check status:
# Check if gh is installed
which gh
# Check gh version
gh --version
# Check authentication status
gh auth status
# List authenticated accounts
gh auth status --show-token
Installation
macOS
Using Homebrew (recommended):
brew install gh
Using MacPorts:
sudo port install gh
Using Conda:
conda install gh --channel conda-forge
Linux
Debian/Ubuntu/Raspbian:
# Add GitHub CLI repository
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# Install
sudo apt update
sudo apt install gh -y
Fedora/CentOS/RHEL:
sudo dnf install gh
Arch Linux:
sudo pacman -S github-cli
Using Snap:
sudo snap install gh
Using Conda:
conda install gh --channel conda-forge
Windows
Using WinGet:
winget install --id GitHub.cli
Using Scoop:
scoop install gh
Using Chocolatey:
choco install gh
Using Conda:
conda install gh --channel conda-forge
Manual Download:
- Download MSI installer from: https://cli.github.com/
Authentication
Interactive Authentication (Recommended)
gh auth login
This will prompt you to:
- Choose GitHub.com or GitHub Enterprise Server
- Choose authentication method (Web browser or Token)
- Complete authentication flow
Token Authentication
# Create token at: https://github.com/settings/tokens
# Required scopes: repo, read:org, workflow
# Authenticate with token
gh auth login --with-token < token.txt
# Or paste token when prompted
gh auth login
Check Authentication
# Verify authentication status
gh auth status
# View authenticated user
gh api user --jq '.login'
# Test API access
gh api rate_limit
Common Errors & Solutions
Error: "gh: command not found"
Cause: gh CLI not installed or not in PATH
Solution:
# Check if gh is installed
which gh
# If not found, install (see Installation section above)
# If installed but not in PATH, add to PATH
# For bash/zsh, add to ~/.bashrc or ~/.zshrc:
export PATH="/path/to/gh/bin:$PATH"
Error: "authentication required"
Cause: Not logged in to GitHub
Solution:
# Login interactively
gh auth login
# Or check authentication status
gh auth status
Error: "HTTP 403: Resource not accessible by integration"
Cause: Insufficient token permissions
Solution:
# Re-authenticate with proper scopes
gh auth login --scopes repo,read:org,workflow
# Or create new token with required scopes:
# https://github.com/settings/tokens
Error: "HTTP 401: Bad credentials"
Cause: Token expired or invalid
Solution:
# Logout and re-authenticate
gh auth logout
gh auth login
Error: "API rate limit exceeded"
Cause: Too many API requests (60/hour unauthenticated, 5000/hour authenticated)
Solution:
# Check rate limit status
gh api rate_limit
# Authenticate to get higher limit (if not already)
gh auth login
# Wait for rate limit reset or use different account
Error: "Could not resolve host: github.com"
Cause: Network connectivity issue
Solution:
# Check internet connection
ping github.com
# Check proxy settings if behind corporate firewall
gh config set http_proxy http://proxy.example.com:8080
# Check DNS resolution
nslookup github.com
Configuration
View Configuration
# View all config settings
gh config list
# View specific setting
gh config get git_protocol
Common Settings
# Set default protocol (https or ssh)
gh config set git_protocol https
# Set default editor
gh config set editor vim
# Set default browser
gh config set browser firefox
# Set proxy
gh config set http_proxy http://proxy.example.com:8080
# Set GitHub Enterprise host
gh config set host github.enterprise.com
Config File Locations
- Linux/macOS:
~/.config/gh/config.yml - Windows:
%AppData%\GitHub CLI\config.yml
Multiple Accounts
# Login to multiple hosts
gh auth login --hostname github.com
gh auth login --hostname github.enterprise.com
# Switch between accounts
gh auth switch
# Check which account is active
gh auth status
Debugging
Enable Debug Mode
# Run command with debug output
GH_DEBUG=api gh search repos "test"
# Or for all commands
export GH_DEBUG=api
View Request/Response
# See HTTP requests and responses
gh api repos/owner/repo --verbose
Check Version
# View gh version
gh --version
# Check for updates
gh extension upgrade --all
Troubleshooting Checklist
When gh CLI isn't working, check these in order:
- [ ] Is gh installed? (
which gh) - [ ] Is gh in PATH? (
echo $PATH| grep gh) - [ ] Is gh authenticated? (
gh auth status) - [ ] Does token have required scopes?
- [ ] Is network connectivity working? (
ping github.com) - [ ] Is rate limit exceeded? (
gh api rate_limit) - [ ] Is gh version up to date? (
gh --version) - [ ] Are config settings correct? (
gh config list)
Getting Help
# Get help for any command
gh help
gh search --help
gh search repos --help
# View manual online
# https://cli.github.com/manual/
Permissions Required for Search
Different search types require different permissions:
- Public repos/issues/PRs: No authentication required (but rate limited)
- Private repos: Requires
reposcope - Organization repos: Requires
read:orgscope - Workflow files: Requires
workflowscope
Token Scopes
Create tokens at: https://github.com/settings/tokens
Minimal scopes for search:
public_repo- Search public repositoriesrepo- Search private repositoriesread:org- Search organization repositories
Recommended scopes:
repo- Full repository accessread:org- Organization accessworkflow- Workflow accessgist- Gist access
Uninstallation
macOS
brew uninstall gh
Linux
# Debian/Ubuntu
sudo apt remove gh
# Fedora/CentOS/RHEL
sudo dnf remove gh
# Arch
sudo pacman -R github-cli
Windows
# WinGet
winget uninstall GitHub.cli
# Scoop
scoop uninstall gh
# Chocolatey
choco uninstall gh
Related
- Official documentation: https://cli.github.com/manual/
- Installation guide: https://github.com/cli/cli#installation
- Authentication guide: https://cli.github.com/manual/gh_auth_login
- For using gh search:
gh-search-code,gh-search-commits,gh-search-issues,gh-search-prs,gh-search-repos