GitHub is widely popular among developers for hosting open-source code repositories for software development and version control. Being a developer-centric service, GitHub has also published a command-line tool for enthusiasts to bring GitHub right to their terminals.

Released almost a year ago, GitHub CLI has quickly become one of the most used command-line tools, by allowing you to perform all the major operations that you can do with the web graphical user interface without needing to leave the Linux terminal.

Learn how to install GitHub CLI on your Linux machine.

Installing GitHub CLI on Linux

While GitHub also offers a desktop app alongside the typical web user interface, choosing the terminal over GUI can help you avoid context switching while writing and running your code. The installation process of GitHub CLI is similar to that of other Linux terminal-based tools.

Related: How to Install Git and Git Bash on Windows

Depending upon the Linux distribution you're using, run the commands below on the terminal emulator of your choice:

Debian, Ubuntu, and its derivatives:

        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

Arch Linux, Manjaro, and its derivatives:

        sudo pacman -S github-cli
    

Fedora, CentOS, and Red Hat Enterprise Linux:

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

On openSUSE/SUSE Linux:

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

In addition to installing via the terminal, you can also download the prebuilt GitHub CLI binaries for your distribution from the releases page. There's also a community-supported snap package version of GitHub CLI available on the Snap Store, but GitHub officially discourages using it.

One Tool for All Your GitHub Operations

As a software developer, Git and GitHub play an integral role in version control for your codebase. With GitHub CLI, you can perform various operations, such as cloning a repository, more quickly with just a few simple commands.

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