Loading...
Loading...
Use when gh CLI is not installed, not configured, or authentication fails - provides installation steps, authentication methods, and troubleshooting for all platforms
npx skill4agent add aaddrick/gh-cli-search gh-cli-setupghgh# 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-tokenbrew install ghsudo port install ghconda install gh --channel conda-forge# 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 -ysudo dnf install ghsudo pacman -S github-clisudo snap install ghconda install gh --channel conda-forgewinget install --id GitHub.cliscoop install ghchoco install ghconda install gh --channel conda-forgegh auth login# 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# 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"# Login interactively
gh auth login
# Or check authentication status
gh auth status# 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# Logout and re-authenticate
gh auth logout
gh auth login# 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# 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 --allwhich ghecho $PATHgh auth statusping github.comgh api rate_limitgh --versiongh config list# Get help for any command
gh help
gh search --help
gh search repos --help
# View manual online
# https://cli.github.com/manual/reporead:orgworkflowpublic_reporeporead:orgreporead:orgworkflowgistbrew 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 ghgh-search-codegh-search-commitsgh-search-issuesgh-search-prsgh-search-repos