GitHub CLI (gh
) is the command-line tool that saves you from constantly switching between your terminal and GitHub's web interface. It's open source, free, and honestly one of the most useful developer tools GitHub has ever shipped.
You're already living in your terminal anyway. You run git commands, execute tests, start dev servers. But the moment you need to create a PR or check why CI failed, you're alt-tabbing to your browser, clicking through GitHub's interface, then context-switching back to code. It's like trying to cook dinner while switching between your kitchen and the neighbor's house every 5 minutes.
What It Actually Does (And What Breaks)
GitHub CLI lets you create pull requests with gh pr create
, check CI status with gh pr checks
, and merge with gh pr merge
- all without leaving terminal. The latest version is 2.78.0 from September 2024, and it's surprisingly solid for a GitHub product.
Pull requests: You can create them fast with `gh pr create`, but reviewing code diffs in the terminal sucks. Use it for quick operations, browser for actual code review. The `gh pr diff` output is harder to read than raw git diff, which is saying something.
Issues: `gh issue create` works great for quick bug reports. Assigning and labeling issues is smooth. The search functionality (`gh issue list`) is decent but GitHub's web search is still better for complex queries.
Actions: `gh run watch` is genuinely useful for watching CI/CD in real-time. Much better than refreshing the browser. But debugging failed workflows? You're back to the web interface because the CLI output is too minimal.
Authentication: The auth flow is decent but you'll probably need to re-auth every few months. `gh auth status` will lie to you sometimes - says you're authenticated but commands still fail with "Error: HTTP 401: Bad credentials (https://api.github.com)". When this happens, just run `gh auth login` again.
Real-World Performance Issues
GitHub CLI is fast for simple operations but has some gotchas:
- Large repos take forever to clone with
gh repo clone
vs regulargit clone
(learned this the hard way trying to clone the Linux kernel repo - took 3x longer than standard git) gh pr list
times out on repos with thousands of PRs (our monorepo breaks it completely after 30 seconds)- JSON output format changes randomly between versions, so pin your CLI version in Docker images (some update around 2.75 broke all our deployment scripts)
- The pagination on list commands is inconsistent - sometimes 30 items, sometimes 100, sometimes it just gives up and shows 5
Automation Reality Check
Great for CI/CD scripts, but the JSON output format changes randomly between versions, so pin your CLI version in Docker images. Most teams use it for:
- Automated PR creation from release scripts
- CI status checks in deployment pipelines
- Issue creation from monitoring alerts
- Release automation (works well once set up)
Authentication in CI is straightforward with GITHUB_TOKEN
, but GitHub Enterprise users get weird permissions issues that'll make you question your career choices. I spent an entire weekend debugging why Enterprise OAuth was rejecting valid tokens - turned out the admin had misconfigured the OAuth app and nobody bothered to document it.
The Truth About Alternatives
GitHub CLI killed the older Hub CLI (which was already half-broken). GitHub Desktop looks nice but falls apart faster than wet cardboard the moment you need anything beyond basic commits. Most serious developers end up using both GitHub CLI and the web interface - CLI for speed, web for detailed work.
It's free, which is weird for GitHub. Works fine with private repos and Enterprise Server, though Enterprise will make you hate your life for 2 days straight while you debug OAuth configurations that work about as well as a chocolate teapot.
Here's what actually breaks: