Here's how you can install the GitHub CLI on a Linux computer to manage your repositories and your GitHub profile from the terminal.

GitHub Octocat figure in front of laptop

GitHub is widely used by developers for hosting open source code repositories for software development and version control. As a developer-centric service, GitHub has also released a command line tool for enthusiasts to bring GitHub straight to their terminals.

Released almost a year ago, GitHub CLI has quickly become one of the most widely used command line tools because it lets you perform all of the important operations you can do with the graphical web user interface without leaving the Linux terminal.

Learn how to install the GitHub CLI on your Linux computer.

Install GitHub CLI on Linux

While GitHub offers a desktop app in addition to the typical web user interface, selecting the terminal via the GUI can help you avoid changing contexts when writing and executing your code. The GitHub CLI installation process is similar to that of other Linux terminal-based tools.

Related: How to Install Git and Git Bash on Windows

Depending on the Linux distribution you are using, run the following commands on the terminal emulator of your choice:

Debian, Ubuntu and its derivatives:

curl -fsSL | 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) stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list> / dev / null
sudo apt update
sudo apt install gh

Arch Linux, Manjaro and its derivatives:

sudo pacman -S github-cli

Fedora, CentOS and Red Hat Enterprise Linux:

sudo dnf config-manager –add-repo
sudo dnf install gh

Under openSUSE / SUSE Linux:

sudo zypper addrepo
sudo zypper ref
sudo zypper install gh

In addition to installing from the terminal, you can also download the pre-built GitHub CLI binaries for your distribution from the release page. There's also a community-supported Snap package version of the GitHub CLI on the Snap Store, but GitHub officially advises against it.

As a software developer, Git and GitHub play an important role in version control of your code base. The GitHub CLI allows you to perform various operations such as cloning a repository faster with just a few simple commands.

Speaking of repository cloning, you can also use Git Bash to do your Git operations from the command line.

Github USB in the laptop

How to clone a GitHub repository using Git Bash

Getting started with GitHub? Learn how to clone a repository using Git Bash.

Continue reading

About the author

Nitin Ranganath
(32 published articles)

Nitin is an avid software developer and computer engineering student who develops web applications using JavaScript technologies. He works as a freelance web developer and enjoys writing for Linux and programming in his free time.

By Nitin Ranganath

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe