GitHub CLI v2.91.0 for managing repositories, pull requests, issues, releases, workflows, codespaces, and more from the terminal. Use when automating GitHub workflows, scripting API calls, managing PRs/issues/releases from the command line, or integrating GitHub into CI/CD pipelines.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
GitHub CLI v2.91.0 for managing repositories, pull requests, issues, releases, workflows, codespaces, and more from the terminal. Use when automating GitHub workflows, scripting API calls, managing PRs/issues/releases from the command line, or integrating GitHub into CI/CD pipelines.
gh is GitHub's official command-line tool that brings pull requests, issues, releases, workflows, codespaces, and other GitHub concepts to the terminal. It is a standalone tool (not a git proxy) written in Go, supporting macOS, Windows, and Linux. Version 2.91.0 adds pseudonymous telemetry, expanded gh skill agent support, and improved skill discovery with hidden directory detection.
Supported platforms: GitHub.com, GitHub Enterprise Cloud, and GitHub Enterprise Server 2.20+.
When to Use
Managing pull requests from the terminal (create, review, merge, checkout)
Creating, listing, editing, and closing issues without leaving the shell
Automating GitHub Actions workflows and run management
Scripting GitHub API calls with gh api for custom automation
Managing releases, secrets, variables, and repository settings from CLI
Working with GitHub Codespaces (create, manage, SSH, ports)
Installing and managing AI agent skills via gh skill
Authenticating to GitHub.com or GitHub Enterprise Server
Searching across code, issues, PRs, commits, and repositories
Installation / Setup
macOS
# Homebrew
brew install gh
# Precompiled binary from releases page# Download from https://github.com/cli/cli/releases/latest
Linux & Unix
# Debian, Ubuntu, Raspberry Pi (apt)# Follow instructions at docs/install_linux.md# Amazon Linux, CentOS, Fedora, openSUSE, RHEL, SUSE (rpm)# Follow instructions at docs/install_linux.md# Precompiled binary from releases page# Download from https://github.com/cli/cli/releases/latest
Windows
# WinGet
winget install GitHub.cli
# Precompiled binary from releases page# Download from https://github.com/cli/cli/releases/latest
GitHub Codespaces
Add to your devcontainer configuration:
"features"
:
{
"ghcr.io/devcontainers/features/github-cli:1"
:
{
}
}
GitHub Actions
GitHub-hosted runners have gh pre-installed and updated weekly. For a specific version, install it using the platform-specific instructions above.
Build from Source
See the install_source.md in the cli/cli repository for building from source.
Binary Verification
Since v2.50.0, gh produces Build Provenance Attestation via Sigstore:
Authentication: gh authenticates via OAuth device flow or personal access tokens. Use gh auth login to begin interactive setup, or gh auth login --with-token for non-interactive token-based authentication.
Repository Context: Commands operate on the current repository by default (detected from git remote). Override with -R OWNER/REPO or set GH_REPO.
Output Formatting: All list/view commands support --json for structured output, --jq for filtering with jq syntax, and --template for Go template rendering.
Aliases: Create shortcuts for frequently used command combinations with gh alias set.
Extensions: Extend gh with community or custom extensions installed via gh extension install.
Skills (v2.91): Install AI agent skills from GitHub repositories using gh skill install, supporting multiple agent hosts (Claude Code, pi, Codex, etc.) with hidden directory discovery (--allow-hidden-dirs).
Usage Examples
Pull Requests
# List open pull requests
gh pr list
# Create a PR interactively
gh pr create
# Create a PR with title and body
gh pr create --title "Fix bug" --body "Fixed the login issue"# Create with reviewers
gh pr create --reviewer monalisa,hubot
# Auto-fill from commit messages
gh pr create --fill
# Checkout a PR locally
gh pr checkout 321
# View PR status
gh pr status
# Check CI status
gh pr checks
# Merge a PR
gh pr merge 123 --delete-branch
# Review a PR
gh pr review 123 --comment --body "Looks good!"
Issues
# List open issues
gh issue list
# Create an issue with label
gh issue create --label bug
# View an issue
gh issue view 123
# Close an issue
gh issue close 123
# Add a comment
gh issue comment 123 --body "Working on this"
Repositories
# Create a new repository
gh repo create my-project --private --source=.
# Clone a repository
gh repo clone cli/cli
# View repository details
gh repo view
# Fork a repository
gh repo fork cli/cli
# Archive/unarchive a repository
gh repo archive owner/repo
gh repo unarchive owner/repo
GitHub Actions
# List workflow runs
gh run list
# View a specific run
gh run view 12345
# Watch a run (follow logs)
gh run watch 12345
# Download artifacts
gh run download 12345
# Rerun a failed job
gh run rerun 12345 --job build
# List workflows
gh workflow list
# Disable/enable a workflow
gh workflow disable ci.yml
gh workflow enable ci.yml
API Access
# REST API call
gh api repos/{owner}/{repo}/releases
# POST with fields
gh api repos/{owner}/{repo}/issues/123/comments -f body='Hi from CLI'# Use jq to filter response
gh api repos/{owner}/{repo}/issues --jq '.[].title'# GraphQL query
gh api graphql -f query='
query {
viewer {
repositories(first: 10) {
nodes { nameWithOwner }
}
}
}
'# Paginated request
gh api graphql --paginate -f query='
query($endCursor: String) {
viewer {
repositories(first: 100, after: $endCursor) {
nodes { nameWithOwner }
pageInfo { hasNextPage endCursor }
}
}
}
'
Skills (v2.91)
# Search for skills
gh skill search terraform
# Install a skill interactively
gh skill install github/awesome-copilot
# Install a specific skill
gh skill install github/awesome-copilot git-commit
# Pin to version
gh skill install github/awesome-copilot git-commit@v1.2.0
# Install from local directory
gh skill install ./my-skills --from-local
# Install for Claude Code at user scope
gh skill install github/awesome-copilot git-commit --agent claude-code --scope user
# Allow hidden directories (.claude/skills/, .agents/skills/)
gh skill install owner/repo --allow-hidden-dirs
# Update all installed skills
gh skill update --all
# Preview a skill before installing
gh skill preview github/awesome-copilot git-commit
Aliases
# Set an alias
gh aliasset bugs 'issue list --label="bug"'# List aliases
gh alias list
# Import aliases from file
gh alias import aliases.json
# Delete an alias
gh alias delete bugs
Advanced Topics
Authentication and Enterprise: OAuth flows, token management, GitHub Enterprise Server setup, SSH key integration → Authentication