GitHub CLI (gh) — Overview#

Identity#

Purpose#

gh is GitHub’s official command-line interface, bringing pull requests, issues, releases, codespaces, and other GitHub concepts directly to the terminal. It is a standalone tool (not a git proxy like its predecessor hub) targeting developers who want to interact with the full GitHub platform without leaving their shell. It supports GitHub.com, GitHub Enterprise Cloud, and GitHub Enterprise Server 2.20+ across macOS, Windows, and Linux.

Significance#

gh is one of the most widely adopted developer CLI tools in the Go ecosystem, maintained by GitHub’s own CLI team and pre-installed on all GitHub Actions runners. It serves as a practical reference for large-scale, feature-rich CLI design in Go — combining a deep Cobra command tree, GraphQL and REST API access, rich TUI components (Bubble Tea, huh, glamour), and supply-chain security features (Sigstore attestations). It is the canonical successor to hub and demonstrates how an opinionated, non-proxy CLI can outgrow a legacy tool in adoption.

Key metrics#

  • Go files: 806
  • Top-level directories: acceptance, api, build, cmd, context, docs, git, internal, pkg, script, test, utils
  • Direct dependencies: 58
  • First commit / age: 2019 (Copyright 2019 GitHub Inc. in LICENSE)

Notable characteristics#

  • Layered TUI stack: Uses Charmbracelet’s Bubble Tea, huh form library, lipgloss, and glamour markdown renderer — one of the most complete terminal-UI dependency sets in any production Go CLI.
  • Dual API clients: Maintains both a REST client (api/) and a GraphQL client (via shurcooL/githubv4) to talk to GitHub — reflecting GitHub’s own API evolution history.
  • Supply-chain security: Since v2.50.0, produces SLSA Build Provenance Attestations signed via Sigstore, and ships gh at verify to verify downloaded releases — a relatively rare commitment to binary authenticity at the CLI layer.
  • Rich extension model: Supports third-party gh-* extensions that users can install, enabling community-built subcommands beyond the core set.
  • Own Go helper library: Publishes github.com/cli/go-gh/v2 as a separately importable package so extension authors can reuse gh’s GitHub API plumbing, authentication, and config abstractions.