| name | gh-cli |
| description | GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line. |
GitHub CLI (gh)
Comprehensive reference for GitHub CLI (gh) - work seamlessly with GitHub from the command line.
Mandatory: Load references only when required for the task at hand. Do not load references preemptively. Use the routing table below to find the relevant reference; load it only when the user's request matches that section.
Version: 2.85.0 (current as of January 2026)
Preflight Check
Before using gh commands, run:
gh auth status
Preflight fails when: gh is not installed, gh auth status returns an error (not logged in), or git credential helper is not configured.
If preflight fails: Load Prerequisites (installation, authentication, setup-git).
CLI Structure
When navigating the gh command hierarchy
Configuration
Global Configuration
When listing, getting, or setting gh config values
Environment Variables
When using GH_TOKEN, GH_HOST, or other gh environment variables
Authentication (gh auth)
Login
When logging in interactively, with token, or web auth
Status
When checking authentication status across hosts
Switch Accounts
When switching between GitHub accounts
Token
When retrieving the active auth token
Refresh
When refreshing credentials or adding/removing scopes
Setup Git
When configuring git credential helper for gh
Browse (gh browse)
When opening repo, issue, PR, or commit in browser
Repositories (gh repo)
Create Repository
When creating a new repository (public, private, org)
Clone Repository
When cloning a repository to local
List Repositories
When listing repos with filters, JSON, or jq
View Repository
When viewing repo details or metadata
Edit Repository
When editing description, visibility, or features
Delete Repository
When deleting a repository
Fork Repository
When forking a repo to your account or org
Sync Fork
When syncing a fork with upstream
Set Default Repository
When setting or unsetting the default repo for current directory
Repository Autolinks
When managing autolinks (e.g. JIRA-123 → URL)
Repository Deploy Keys
When listing, adding, or deleting deploy keys
Gitignore and License
When viewing gitignore or license templates
Issues (gh issue)
Create Issue
When creating an issue with title, body, labels, assignees
List Issues
When listing issues with filters, search, or JSON
View Issue
When viewing issue details or comments
Edit Issue
When editing title, body, labels, assignees, milestone
Close/Reopen Issue
When closing or reopening an issue
Comment on Issue
When adding, editing, or deleting issue comments
Issue Status
When viewing issue status summary
Pin/Unpin Issues
When pinning or unpinning issues to repo dashboard
Lock/Unlock Issue
When locking or unlocking issue conversation
Transfer Issue
When transferring an issue to another repo
Delete Issue
When deleting an issue
Develop Issue (Draft PR)
When creating a draft PR from an issue
Pull Requests (gh pr)
Create Pull Request
When creating a PR with title, body, reviewers, labels
List Pull Requests
When listing PRs with filters, search, or JSON
View Pull Request
When viewing PR details, diff, or comments
Checkout Pull Request
When checking out a PR branch locally
Diff Pull Request
When viewing PR diff or exporting patch
Merge Pull Request
When merging a PR (merge, squash, rebase)
Close Pull Request
When closing a PR without merging
Reopen Pull Request
When reopening a closed PR
Edit Pull Request
When editing PR title, body, labels, reviewers
Ready for Review
When marking a draft PR as ready
Pull Request Checks
When viewing or watching PR check status
Comment on Pull Request
When adding, editing, or deleting PR comments
Review Pull Request
When approving, requesting changes, or commenting on a PR
Update Branch
When updating PR branch with latest base
Lock/Unlock Pull Request
When locking or unlocking PR conversation
Revert Pull Request
When reverting a merged PR
Pull Request Status
When viewing PR status summary
GitHub Actions
Workflow Runs (gh run)
When listing, viewing, rerunning, or downloading run artifacts
Workflows (gh workflow)
When listing, enabling, disabling, or running workflows
Action Caches (gh cache)
When listing or deleting Actions caches
Action Secrets (gh secret)
When managing repository or org secrets
Action Variables (gh variable)
When managing repository or org variables
Projects (gh project)
When managing projects, fields, items, links
Releases (gh release)
When creating, viewing, uploading, or downloading releases
Gists (gh gist)
When listing, creating, editing, or cloning gists
Codespaces (gh codespace)
When creating, SSHing, or managing codespaces
Organizations (gh org)
When listing or viewing organizations
Search (gh search)
When searching code, commits, issues, PRs, or repos
Labels (gh label)
When listing, creating, editing, or cloning labels
SSH Keys (gh ssh-key)
When listing, adding, or deleting SSH keys
GPG Keys (gh gpg-key)
When listing, adding, or deleting GPG keys
Status (gh status)
When viewing status overview for repos
Configuration (gh config)
When listing, getting, or setting gh config
Extensions (gh extension)
When installing, listing, or creating extensions
Aliases (gh alias)
When setting, listing, or importing aliases
API Requests (gh api)
When making REST or GraphQL API requests via gh
Rulesets (gh ruleset)
When listing, viewing, or checking rulesets
Attestations (gh attestation)
When downloading or verifying attestations
Completion (gh completion)
When generating shell completion scripts
Preview (gh preview)
When listing or running preview features
Agent Tasks (gh agent-task)
When listing, viewing, or creating agent tasks
Global Flags
When using --help, --json, --jq, --web, etc.
Output Formatting
JSON Output
When using --json and --jq for structured output
Template Output
When using --template for custom formatting
Common Workflows
Create PR from Issue
When creating a PR that closes an issue
Bulk Operations
When closing multiple issues or labeling multiple PRs
Repository Setup Workflow
When creating repo with initial setup and labels
CI/CD Workflow
When running workflow and downloading artifacts
Fork Sync Workflow
When forking and syncing with upstream
Environment Setup
Shell Integration
When adding completion and aliases to shell
Git Configuration
When configuring git credential helper for gh
Best Practices
When following auth, default repo, jq, pagination, cache practices
Getting Help
When looking up command help or topics
References
Official manual, docs, REST API, GraphQL API