GitHub CLI
cli.github.com- Category
- Developer Tools
- Rank
- No. 220Tools index
- Pricing
- Free
- Type
- TOOL
- Use case
- Coding · Productivity & Collaboration
- Interfaces
- CLI
- Builder
- cli
- GitHub
- 46.4k stars
- Latest release
- v2.101.0
- Date
About
GitHub from your terminal — PRs, issues, repos, actions, all without leaving the command line. Essential for any dev workflow.
What it does
This is the official command line client for GitHub, written in Go. Every GitHub resource such as issues, pull requests, releases, and actions gets its own family of subcommands. It authenticates by registering itself as a git credential helper, so ordinary clone and push commands reuse the same login. Internally it reaches GitHub over both its REST and GraphQL interfaces, picking whichever a given command needs.
Why it's ranked here
It ranks highly because it is the officially maintained bridge between the terminal and GitHub's own API, not a community wrapper. Releases carry cryptographically signed build provenance attestations verified through Sigstore, the codebase is MIT licensed, and the project ships an installable skill so coding agents can drive it directly rather than shelling out blind. That combination of trust, license, and agent readiness is rare for a CLI this central to daily development.
What's good
The API layer is deliberately careful: request options let a command opt out of following redirects so a delete on a renamed resource cannot silently downgrade into a harmless-looking GET. Every command that emits structured data supports JSON output with field selection and a query template, so scripts get stable fields independent of the human-readable view. Enterprise requests automatically disable telemetry, and authentication tokens are injected per host rather than hardcoded, so one login works across GitHub.com, Enterprise Cloud, and enterprise server instances.
Tradeoffs
Three top-level packages the project's own layout doc labels deprecated, one for git remotes, one for older tests, one for table printing, are still present rather than removed, a sign of incomplete internal cleanup. Its acceptance test suite creates and modifies real GitHub resources, so it cannot run against a sandbox and needs a dedicated authorized account. Outside contributors also face a formal gate: unsolicited pull requests are turned away unless an issue already carries explicit maintainer sign-off.
How to use it well
This fits engineers who already live in the terminal and want pull requests, issue triage, and workflow runs scriptable from the same shell as git, piping JSON output into other tools instead of parsing a web page. Coding agents can install the companion skill to drive it directly rather than guessing at flags. It is not a replacement for a GitHub API client embedded in an application, and it offers nothing for code hosted outside GitHub or GitHub Enterprise Server.
Technical notes+
The entry point in cmd/gh/main.go calls ghcmd.Main and forwards its exit code to the OS; docs/project-layout.md traces the resulting call chain from root.NewCmdRoot down into the pkg/cmd command tree, and that same document marks the context package (context/context.go) as deprecated, kept only for resolving git remotes to repositories. api/client.go wraps the go-gh REST and GraphQL clients and adds a WithoutFollowingRedirects request option specifically so Go's default redirect handling cannot silently turn a DELETE into a GET. api/http_client.go builds on that with a User-Agent string, a per-host AddAuthTokenHeader transport that injects the caller's token, and a telemetryDisablerTransport that turns off telemetry once the resolved hostname is an enterprise host. git/client.go shells out to the system git binary through safeexec and AuthenticatedCommand, which installs gh itself as a per-host git credential helper. go.mod declares module github.com/cli/cli/v2 on Go 1.27, with charm.land/bubbletea, spf13/cobra, sigstore/sigstore-go, and theupdateframework/go-tuf among its direct dependencies. LICENSE is MIT, copyright GitHub Inc. AGENTS.md, and CLAUDE.md which is only an include of it, impose a contribution gate: an external upstream pull request needs an issue carrying both a help-wanted label and explicit acceptance criteria before work starts.
Observed
- License
- MIT
- Language
- Go
- Interface
- Command-line only; internally calls GitHub's REST and GraphQL APIs but exposes no public library or HTTP API of its own
- Platform support
- macOS, Windows, and Linux/Unix, plus GitHub Codespaces via a devcontainer feature
- Hosting support
- GitHub.com, GitHub Enterprise Cloud, and supported GitHub Enterprise Server versions
- Authentication mechanism
- Installs itself as a per-host git credential helper so ordinary git commands reuse the CLI's stored token
- Request safety
- A dedicated request option can disable HTTP redirect following, preventing Go's default policy from turning a DELETE into a GET on redirect
- Structured output
- Commands support JSON output with field selection and a query template, independent of the human-readable view
- Release verification
- Release binaries carry signed build provenance attestations, checkable through Sigstore
- Deprecated internal packages
- The project's own layout documentation marks the context, test, and utils top-level packages as deprecated
- Contribution policy
- External upstream pull requests require a tracked issue with both a help-wanted label and explicit acceptance criteria before implementation starts
Read from README.md, go.mod, cmd/gh/main.go, api/client.go, api/http_client.go, git/client.go, context/context.go, docs/command-development.md, docs/project-layout.md, docs/gh-vs-hub.md, AGENTS.md, CLAUDE.md, LICENSE, docs/source.md, Makefile.
What it can do
Create pull requests
Branch with code changes → Pull request in GitHub repository
Manage issues
Issue details and commands → Created, updated, or closed GitHub issues
Clone repositories
Repository URL or name → Local copy of repository
View GitHub Actions workflow status
Repository and workflow identifiers → Workflow run status and logs
Review and merge pull requests
Pull request ID and review comments → Approved and merged pull request
Create and manage repositories
Repository name and configuration → New GitHub repository
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.