01 Overview
The `gh` CLI brings GitHub — PRs, issues, releases, and Actions runs — into the terminal so you can review a diff, kick off a workflow, or cut a release without leaving a shell session.
→ official documentation02 Installation
Pick a platform. Each step is copy-pasteable on its own.
01 Add the GitHub CLI GPG key and repo
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
02 Install
sudo apt update sudo apt install -y gh
03 Verify
gh --version
01 Add the GitHub CLI repo
sudo dnf install -y 'dnf-command(config-manager)' sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
02 Install
sudo dnf install -y gh
03 Verify
gh --version
01 Install via Homebrew
brew install gh
02 Verify
gh --version
Note — commands assume sudo privileges and an up-to-date package index. Pin a specific version in production rather than tracking latest.
03 Install script
The steps above bundled into a single idempotent shell script for provisioning boxes unattended.
install-github-cli.sh
Ubuntu/Debian target · safe to re-run · exits non-zero on failure
04 Cheatsheet
The commands reached for most often once GitHub CLI is installed.
| Command | What it does |
|---|---|
| gh auth login | Authenticate the CLI with a GitHub account |
| gh repo clone owner/repo | Clone a repository |
| gh pr create --fill | Open a pull request from the current branch |
| gh pr list | List open pull requests |
| gh pr checkout 123 | Check out a PR by number |
| gh issue list | List open issues |
| gh workflow run name.yml | Trigger a GitHub Actions workflow |
| gh release create v1.0.0 | Cut a new release |