Every gh command,
with the example you need
A fast, no-nonsense reference for the GitHub CLI. Real commands, every flag, and fixes for the errors you'll actually hit — all copy-paste ready.
01 — The reference
22 commands, 6 things you actually do
02 — First things first
gh vs git — what's the difference?
The single most common point of confusion for people new to the GitHub CLI.
git your machine
Manages your local repository: commits, branches, merges, history. It only talks to GitHub for push, pull, and fetch.
- git commit / branch / rebase
- git push & git pull
- Knows nothing about pull requests or issues
gh the GitHub layer
Manages everything GitHub adds on top: pull requests, issues, releases, Actions, and the API — all from the same terminal.
- gh pr / issue / release
- gh run & gh workflow for Actions
- gh api for anything else
Short version: git moves code, gh moves GitHub. They're complements, not competitors — you use both.
03 — Setup
Install gh in one line
The GitHub CLI runs on macOS, Windows, and Linux. Install it, sign in once, and every command on this site just works.
Homebrew
brew install ghWinGet
winget install --id GitHub.cliDebian / Ubuntu
sudo apt install ghThen sign in once and you're ready:
gh auth loginThe whole reference, on one page
Download the ghcli cheat sheet — every core command with its most useful example, ready to pin next to your terminal.
04 — FAQ
GitHub CLI, answered
What is the GitHub CLI (gh)?
The GitHub CLI, invoked as gh, is GitHub's official command-line tool. It brings pull requests, issues, releases, GitHub Actions, and the full API into your terminal, so you can work with GitHub without switching to a browser.
Is the GitHub CLI free?
Yes. gh is free and open source, available for macOS, Windows, and Linux. It works with free GitHub accounts as well as Team, Enterprise Cloud, and Enterprise Server.
What is the difference between gh and git?
git manages your local repository — commits, branches, and history. gh manages GitHub-specific things layered on top, like pull requests, issues, and Actions. You use them together.
How do I install the GitHub CLI?
Install gh with a package manager: brew install gh on macOS, winget install --id GitHub.cli on Windows, or sudo apt install gh on Debian and Ubuntu. Then run gh auth login to sign in.
Is ghcli.com the official GitHub CLI site?
No. ghcli.com is an independent, unofficial command reference. The official tool and documentation live at cli.github.com and github.com/cli/cli.