GitHub
GitHub operations via gh CLI: issues, PRs, CI runs, code review, and API queries.
Tags: github, git, development, ci-cd, pr
Category: Development
Use Cases
- Check PR status and CI results during conversations
- Create issues from chat discussions
- Review and merge PRs from the terminal
- Monitor workflow runs and re-run failed jobs
- Query repository metadata and statistics
- Automate release management with gh release create
- Search code across repositories with gh search
Tips
- Always use `--json` with `--jq` for scriptable output: `gh pr list --json number,title --jq '.[] | .number'`
- Use `gh api` for anything the CLI doesn't cover natively — full REST and GraphQL access
- Check CI without opening a browser: `gh pr checks <number>` shows all status checks
- Use `gh run view <id> --log-failed` to see only the failed step logs — saves scrolling
- Create aliases for common operations: `gh alias set prs 'pr list --author @me'`
- Multi-account support: `gh auth login --hostname github.example.com` for GitHub Enterprise
- Pipe JSON output to jq for complex filtering: `gh issue list --json labels --jq '.[].labels[].name' | sort -u`
Known Issues & Gotchas
- Requires `gh auth login` before first use — interactive browser flow needed
- Don't use for local git operations (commit, push, pull) — use `git` directly
- Some commands behave differently in CI vs local (`gh pr list` pagination differs)
- `gh pr create --reviewer` can be slow in repos with many collaborators
- GitHub CLI still cannot show inline PR review comments in the terminal (long-standing limitation)
- Rate limits: 5,000 API requests/hour for authenticated users
- GraphQL queries via `gh api graphql` have a separate rate limit of 5,000 points/hour
- Don't confuse with the gh-issues skill — this is general-purpose, that's an autonomous pipeline
Alternatives
- GitHub Web UI
- GitKraken CLI
- hub (legacy)
- GitHub REST API (curl)
Community Feedback
Do you consider the Github CLI tools essential? Absolutely. gh pr create, gh pr merge, gh run view — I can't imagine going back to the web UI for these.
— Reddit r/github
The github CLI saved me a lot of times. Being able to check CI status, view PRs, and manage issues without leaving the terminal is a game changer.
— Reddit r/ProgrammerHumor
Github CLI Skill — having Claude manage my GitHub workflow through gh commands has been transformative. PR reviews, issue triage, CI monitoring.
— Reddit r/ClaudeAI
gh is the official CLI for GitHub. It brings pull requests, issues, and other GitHub concepts to the terminal, making it easy to script and automate workflows.
— Graphite Guide
Configuration Examples
Initial setup
# Authenticate with GitHub
gh auth login
# Verify auth
gh auth status
# Check token scopes
gh auth token | gh api user -H 'Authorization: token $(cat -)'PR workflow
# List your open PRs
gh pr list --author @me
# Check CI on a specific PR
gh pr checks 55
# View PR with diff stats
gh pr view 55
# Merge when ready
gh pr merge 55 --squash --delete-branchIssue management
# List bugs
gh issue list --label bug --state open
# Create an issue
gh issue create --title 'Fix: login timeout' --body 'Steps to reproduce...' --label bug
# Close with comment
gh issue close 42 --comment 'Fixed in #55'API queries with jq
# Get repo stats
gh api repos/owner/repo --jq '{stars: .stargazers_count, forks: .forks_count, issues: .open_issues_count}'
# List all unique labels
gh api repos/owner/repo/labels --jq '.[].name' | sort
# Get PR review comments
gh api repos/owner/repo/pulls/55/reviews --jq '.[].body'Installation
brew install ghSource: bundled