To install GitHub CLI, run winget install --id GitHub.cli --source winget on Windows, brew install gh on macOS, or add GitHub's package repository and run sudo apt install gh (Debian, Ubuntu) or sudo dnf install gh (Fedora, RHEL) on Linux. Then run gh --version to confirm it works and gh auth login to sign in.
GitHub CLI is the gh command. It works with pull requests, issues, releases and repositories from the terminal. Every command below comes from the official GitHub CLI documentation, and the package names are the ones that project lists.
Install GitHub CLI on Windows
The official method is WinGet, which ships with current versions of Windows 11 and Windows 10:
winget install --id GitHub.cli --source winget
The installer changes your PATH. Close your terminal and open a new window before running gh. The official docs point out that in Windows Terminal a new tab is not enough, because it does not pick up the changed PATH. You need a new window.
To upgrade later:
winget upgrade --id GitHub.cli --source winget
The GitHub CLI team also lists two community packages, Chocolatey (choco install gh) and Scoop (scoop install gh). They say it does not maintain these and cannot guarantee their stability, security or availability. If you already use one of those package managers, they work, but WinGet is the supported route. Precompiled binaries are also available from the project's releases page on GitHub if you prefer to manage the files yourself.
Install GitHub CLI on Mac
The official method is Homebrew:
brew install gh
Upgrade with:
brew upgrade gh
If you don't use Homebrew, the macOS install page lists community options: MacPorts (sudo port install gh), Conda (conda install gh --channel conda-forge), Spack, Flox and Webi. As on Windows, these are unofficial and the GitHub CLI team does not support them. The releases page also has precompiled macOS binaries.
Install GitHub CLI on Linux
Linux has the most variation, because the right command depends on your distribution's package manager. The official docs give repository setup steps for Debian and Ubuntu (apt), Fedora and RHEL (dnf), Amazon Linux 2 (yum) and openSUSE (zypper). Use the official GitHub repository where one is listed, because the version your distribution ships can lag behind.
Debian and Ubuntu (apt)
This single command, copied from the official docs, installs wget if needed, adds GitHub's signing key and repository, and installs gh:
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
To upgrade later, run sudo apt update and then sudo apt install gh. The docs recommend the official packages over the community Debian and Ubuntu builds, and they say the community 2.45.x and 2.46.x versions are broken because of deprecated GitHub APIs. They also strongly discourage installing gh as a Snap.
Fedora and RHEL (dnf)
On DNF5 (current Fedora):
sudo dnf install dnf5-plugins
sudo dnf config-manager addrepo --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh
On DNF4 (older Fedora, RHEL and derivatives), the repository command differs:
sudo dnf install 'dnf-command(config-manager)'
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh
Upgrade with sudo dnf update gh. Fedora also has a community package, so a plain sudo dnf install gh may work without adding the repository, but that package is unofficial.
openSUSE and SUSE (zypper)
sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
sudo zypper ref
sudo zypper install gh
Other distributions
Most other distributions carry a community package named gh or github-cli. These are the commands the docs list:
| Platform | Command |
|---|---|
| Arch Linux | sudo pacman -S github-cli |
| Alpine Linux | apk add github-cli |
| Void Linux | sudo xbps-install github-cli |
| NixOS (temporary shell) | nix-shell -p gh |
| Homebrew on Linux | brew install gh |
| Conda | conda install gh --channel conda-forge |
The docs also list FreeBSD, OpenBSD, Gentoo and others, and say precompiled binaries for 386, amd64, arm64 and armv6 are on the releases page. Community packages are unofficial and unsupported by the GitHub CLI team.
Check that it installed
gh --version
Example output (your version number and date will differ):
gh version 2.x.x (2026-xx-xx)
https://github.com/cli/cli/releases/tag/v2.x.x
If your shell says gh is not found, the usual cause is a terminal opened before the install. Open a new window and try again.
Sign in with gh auth login
Installing gh does not sign you in. Start the interactive setup:
gh auth login
It asks which host to use (GitHub.com or an Enterprise server), which protocol git should use (HTTPS or SSH), and how to authenticate. The default is the browser flow, which gives you a one-time code to enter on GitHub. The token is stored in your system's credential store, or in a plain text file if no credential store is available. Run gh auth status to see where it was saved.
A few flags from the manual are worth knowing:
gh auth login --web --clipboardopens the browser and copies the one-time code for you.gh auth login --with-token < mytoken.txtreads a personal access token from standard input. For a classic token, the required scopes arerepo,read:organdgist.gh auth login --hostname enterprise.internalsigns in to a host other than github.com.--git-protocol sshor--git-protocol httpssets the protocol without the prompt.
For scripts and CI, the manual says gh can use a token from the environment. In GitHub Actions, that means setting GH_TOKEN: ${{ github.token }} under env. If you choose SSH, you also need a key registered with your account; see how to add an SSH key to GitHub.
What to do after installing
With gh signed in, you can clone a repository by name, which avoids copying URLs:
gh repo clone cli/cli
For the Git side of the workflow, including commits and pushes, read how to push to GitHub. If GitHub itself is new to you, how to use GitHub as a beginner covers repositories and the basic vocabulary.
If the install fails
ghis not recognized or not found. Open a new terminal window so it reads the updated PATH. On Windows Terminal, a new tab is not enough.- apt cannot find the package. Confirm the file
/etc/apt/sources.list.d/github-cli.listexists and runsudo apt updateagain. - An old or broken version from a community package. Remove it and install from the official repository. The docs name the community 2.45.x and 2.46.x builds as broken.
- A Snap install behaves oddly. The docs strongly discourage the Snap, so switch to the apt, dnf or zypper route above.
Frequently asked questions
- Is GitHub CLI the same thing as Git?
- No. Git is the version control tool that tracks your code and talks to remotes. GitHub CLI (the gh command) is a separate program that talks to GitHub itself: pull requests, issues, releases and repository settings. You still need Git installed to clone and push.
- Do I need to install Git before GitHub CLI?
- gh can run without Git for commands that only call the GitHub API, but anything that clones, commits or pushes needs Git on your PATH. Install Git first so gh repo clone and similar commands work.
- How do I update GitHub CLI?
- Use the same package manager you installed it with: winget upgrade --id GitHub.cli --source winget on Windows, brew upgrade gh on macOS, sudo apt update followed by sudo apt install gh on Debian and Ubuntu, or sudo dnf update gh on Fedora and RHEL.
- Why does the terminal say gh is not recognized after installing?
- The installer changed your PATH, and the terminal you are in was started before that. Close it and open a new window. On Windows Terminal, the official docs say to open a new window, because a new tab does not pick up the change.