Skip to content

Latest commit

 

History

History
272 lines (183 loc) · 6.92 KB

install_linux.md

File metadata and controls

272 lines (183 loc) · 6.92 KB

Installing gh on Linux and BSD

Packages downloaded from https://cli.github.com or from https://github.com/cli/cli/releases are considered official binaries. We focus on popular Linux distros and the following CPU architectures: i386, amd64, arm64, armhf.

Other sources for installation are community-maintained and thus might lag behind our release schedule.

Official sources

Debian, Ubuntu Linux, Raspberry Pi OS (apt)

Install:

(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
	&& sudo mkdir -p -m 755 /etc/apt/keyrings \
	&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
	&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
	&& 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

Upgrade:

sudo apt update
sudo apt install gh

Note

If errors regarding GPG signatures occur, see cli/cli#9569 for steps to fix this.

Fedora, CentOS, Red Hat Enterprise Linux (dnf5)

Install from our package repository for immediate access to latest releases:

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 --repo gh-cli

These commands apply for dnf5. If you're using dnf4, commands will vary slightly.

Show dnf4 commands
sudo dnf4 install 'dnf-command(config-manager)'
sudo dnf4 config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf4 install gh --repo gh-cli

Note

If errors regarding GPG signatures occur, see cli/cli#9569 for steps to fix this.

Alternatively, install from the community repository:

sudo dnf install gh

Upgrade:

sudo dnf update gh

Amazon Linux 2 (yum)

Install using our package repository for immediate access to latest releases:

type -p yum-config-manager >/dev/null || sudo yum install yum-utils
sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo yum install gh

Upgrade:

sudo yum update gh

Note

If errors regarding GPG signatures occur, see cli/cli#9569 for steps to fix this.

openSUSE/SUSE Linux (zypper)

Install:

sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
sudo zypper ref
sudo zypper install gh

Upgrade:

sudo zypper ref
sudo zypper update gh

Note

If errors regarding GPG signatures occur, see cli/cli#9569 for steps to fix this.

Manual installation

Unofficial, community-supported methods

The GitHub CLI team does not maintain the following packages or repositories and thus we are unable to provide support for those installation methods.

Snap (do not use)

There are so many issues with Snap as a runtime mechanism for apps like GitHub CLI that our team suggests never installing gh as a snap.

Arch Linux

Arch Linux users can install from the extra repo:

sudo pacman -S github-cli

Alternatively, use the unofficial AUR package to build GitHub CLI from source.

Android

Android 7+ users can install via Termux:

pkg install gh

FreeBSD

FreeBSD users can install from the ports collection:

cd /usr/ports/devel/gh/ && make install clean

Or via pkg(8):

pkg install gh

NetBSD/pkgsrc

NetBSD users and those on platforms supported by pkgsrc can install the gh package:

pkgin install gh

To install from source:

cd /usr/pkgsrc/net/gh && make package-install

OpenBSD

In -current, or in releases starting from 7.0, OpenBSD users can install from packages:

pkg_add github-cli

Funtoo

Funtoo Linux has an autogenerated github-cli package, located in dev-kit, which can be installed in the following way:

emerge -av github-cli

Upgrading can be done by syncing the repos and then requesting an upgrade:

ego sync
emerge -u github-cli

Gentoo

Gentoo Linux users can install from the main portage tree:

emerge -av github-cli

Upgrading can be done by updating the portage tree and then requesting an upgrade:

emerge --sync
emerge -u github-cli

Kiss Linux

Kiss Linux users can install from the community repos:

kiss b github-cli && kiss i github-cli

Nix/NixOS

Nix/NixOS users can install from nixpkgs:

nix-env -iA nixos.gh

Flox

Flox users can install from the official community nixpkgs.

# To install
flox install gh

# To upgrade
flox upgrade toplevel

For more information about Flox, see its homepage.

openSUSE Tumbleweed

openSUSE Tumbleweed users can install from the official distribution repo:

sudo zypper in gh

Alpine Linux

Alpine Linux users can install from the stable releases' community package repository.

apk add github-cli

Users wanting the latest version of the CLI without waiting to be backported into the stable release they're using should use the edge release's community repo through this method below, without mixing packages from stable and unstable repos.1

echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
apk add github-cli@community

Void Linux

Void Linux users can install from the official distribution repo:

sudo xbps-install github-cli

Footnotes

  1. https://wiki.alpinelinux.org/wiki/Package_management#Repository_pinning