skills/gh-cli-setup/SKILL.md
Use when gh CLI is not installed, not configured, or authentication fails - provides installation steps, authentication methods, and troubleshooting for all platforms
npx skillsauth add aaddrick/gh-cli-search gh-cli-setupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps diagnose and fix GitHub CLI (gh) installation, configuration, and authentication issues.
IMPORTANT: When providing installation instructions, always:
Use this skill when:
gh command not foundRun 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
Using Homebrew (recommended):
brew install gh
Using MacPorts:
sudo port install gh
Using Conda:
conda install gh --channel conda-forge
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
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:
gh auth login
This will prompt you to:
# 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
# Verify authentication status
gh auth status
# View authenticated user
gh api user --jq '.login'
# Test API access
gh api rate_limit
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"
Cause: Not logged in to GitHub
Solution:
# Login interactively
gh auth login
# Or check authentication status
gh auth status
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
Cause: Token expired or invalid
Solution:
# Logout and re-authenticate
gh auth logout
gh auth login
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
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
# View all config settings
gh config list
# View specific setting
gh config get git_protocol
# 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/gh/config.yml%AppData%\GitHub CLI\config.yml# 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
# Run command with debug output
GH_DEBUG=api gh search repos "test"
# Or for all commands
export GH_DEBUG=api
# See HTTP requests and responses
gh api repos/owner/repo --verbose
# View gh version
gh --version
# Check for updates
gh extension upgrade --all
When gh CLI isn't working, check these in order:
which gh)echo $PATH | grep gh)gh auth status)ping github.com)gh api rate_limit)gh --version)gh config list)# Get help for any command
gh help
gh search --help
gh search repos --help
# View manual online
# https://cli.github.com/manual/
Different search types require different permissions:
repo scoperead:org scopeworkflow scopeCreate tokens at: https://github.com/settings/tokens
Minimal scopes for search:
public_repo - Search public repositoriesrepo - Search private repositoriesread:org - Search organization repositoriesRecommended scopes:
repo - Full repository accessread:org - Organization accessworkflow - Workflow accessgist - Gist accessbrew uninstall gh
# Debian/Ubuntu
sudo apt remove gh
# Fedora/CentOS/RHEL
sudo dnf remove gh
# Arch
sudo pacman -R github-cli
# WinGet
winget uninstall GitHub.cli
# Scoop
scoop uninstall gh
# Chocolatey
choco uninstall gh
gh-search-code, gh-search-commits, gh-search-issues, gh-search-prs, gh-search-repostools
MANDATORY skill when users mention GitHub CLI searches - establishes non-negotiable requirement to use gh-cli-search skills for correct syntax, quoting, and platform handling
development
SLASH COMMAND ONLY - Do NOT invoke automatically. Only runs via /test-gh-skills command. Executes Python test orchestrator for 80 tests across 6 skill groups.
tools
Use when searching GitHub via CLI for issues, PRs, repos, code, or commits - provides correct syntax for exclusions, qualifiers, quoting, and platform-specific handling to avoid command failures
tools
Use when searching for repositories across GitHub - provides syntax for filtering by stars, forks, language, topics, license, archived status, and all repository attributes