Skip to content
Latchkey

gh CLI vs hub: GitHub from the Command Line

Pick gh, the official, actively maintained GitHub CLI, for almost everything today; hub (which wraps git to add GitHub features) is effectively legacy and no longer the recommended choice for new work.

gh (GitHub CLI) and hub both bring GitHub to the terminal, but the landscape has shifted. hub came first and works by wrapping git, extending commands so things like git pull-request work. gh is GitHub s official, standalone CLI with broad coverage (PRs, issues, releases, Actions, gists, API) and active development. For new projects and CI, gh is the maintained, recommended tool; hub is largely in maintenance mode.

gh CLIhub
MaintainerOfficial (GitHub)Community (legacy)
ModelStandalone gh commandWraps/extends git
ScopePRs, issues, releases, Actions, APIPRs, fork, and git extensions
MaintenanceActiveMinimal / legacy
Authgh auth login / tokenToken-based
Recommended forNew work and CIExisting legacy scripts

Why gh is the default now

gh covers far more of GitHub than hub: opening and reviewing PRs, managing issues and releases, viewing Actions runs, calling the API with gh api, and scripting with JSON output. As the official CLI it tracks new GitHub features. hub s git-wrapping approach was clever but narrower, and it is no longer actively developed, so it lags behind on newer functionality.

In CI

gh is preinstalled on GitHub-hosted runners and authenticates automatically from the GITHUB_TOKEN, which makes it ideal for workflow scripting: comment on PRs, create releases, dispatch workflows, or query the API without extra setup. hub can run in CI but needs manual installation and token configuration and offers less. For automating GitHub from a pipeline, gh is the clear pick.

Migration note

If you have scripts using hub, most actions have a direct gh equivalent (for example, hub s pull-request maps to gh pr create). Because gh does not wrap git, you call it explicitly rather than through git subcommands, which is usually clearer. There is little reason to start new automation with hub today.

The verdict

Use gh, the official GitHub CLI, for new work and especially in CI where it is preinstalled and auto-authenticated. Keep hub only to support existing legacy scripts, and migrate them to gh when convenient.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →