Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
184 lines (120 loc) · 5.01 KB

File metadata and controls

184 lines (120 loc) · 5.01 KB

Installing gh on Linux and FreeBSD

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.

If none of our official binaries, packages, repositories, nor community sources work for you, we recommend using our Makefile to build gh from source. It's quick and easy.

Official sources

Debian, Ubuntu Linux (apt)

⚠️ This will only work for the architectures we officially support.

The below should work for any debian-based distribution. You can change stable to a specific codename we support if that is your preference.

Install:

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /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
sudo apt update
sudo apt install gh

Note: If you get "gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory" error, try installing the dirmngr package. Run sudo apt-get install dirmngr and repeat the steps above.

Upgrade:

sudo apt update
sudo apt install gh

Fedora, CentOS, Red Hat Enterprise Linux (dnf)

Install:

sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh

Upgrade:

sudo dnf update gh

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

Manual installation

openSUSE/SUSE Linux (zypper)

Install and upgrade:

  1. Download the .rpm file from the releases page;
  2. Install the downloaded file: sudo zypper in gh_*_linux_amd64.rpm

Unofficial, Community-supported methods

The core GitHub CLI team does not maintain the following packages or repositories. They are unofficial and we are unable to provide support or guarantees for them. They are linked here as a convenience and their presence does not imply continued oversight from the CLI core team. Users who choose to use them do so at their own risk.

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 community 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

Homebrew (Linuxbrew)

Linuxbrew users can install it as a brew package:

brew 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

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.gitAndTools.gh

openSUSE Tumbleweed

openSUSE Tumbleweed users can install from the official distribution repo:

sudo zypper in gh