gh on Linux: Installation & Configuration

Github Cli

In this tutorial, we’ll see how to install & configure Gh on Linux with apt package manager or homebrew.

gh is a command-line tool that enhances Git’s capabilities by offering attributes like simplified pull request handling, enhanced teamwork, and an uniform user experience across platforms.

By integrating Gh with other technologies for a fluid development process, developers and teams working with Git repositories can increase their productivity and efficiency.

gh integrates with other technologies to make development more efficient and productive for developers and teams working with Git repositories.

Install gh with apt

apt is the standard package manager for linux based distribution like debian. It resolves dependencies needed for the installation and is used to install, update, and uninstall software packages from the system.

Step 1: Update Package Manager

Using these commands before any installation using apt is always a good practice.

sudo apt update
sudo apt upgrade

Step 2: Install the GitHub CLI using apt

sudo apt install gh
Apt Install Gh
apt install gh

Step 3: Checking gh version

Once the installation is complete, you may confirm that gh is installed by using the following command:

gh --version
Gh Version Apt
gh version

Install gh with Homebrew

Homebrew is a Linux package manager that makes it easier to install, manage, and update software packages and their dependencies.

For this, at first, you need to have homebrew for Linux installed in your system. You can install it following these official documentation of homebrew.

Step 1: Update HomeBrew

brew update is a command that updates Homebrew, the formulas that are available, and the installed packages. It is advised to run brew update on a regular basis to make sure the installed packages are compatible and current.

brew update

Step 2: Install GitHub CLI with HomeBrew

brew install gh
Install Gh Using Brew
Install Gh Using Brew

Step 3: Checking gh Version

Using the following command after the installation is finished will allow you to verify that gh is installed:

gh --verison
Gh Version
gh on Linux

Configure gh with GitHub

Let’s now configure the gh command with Github.

Step 1: gh Auth Login

You may configure GitHub CLI (gh) after using brew or apt to install it on your Linux machine by typing the following command in your terminal:

gh auth login
Gh Auth Login
gh Auth Login
Gh Protocol 2
gh Protocol
Gh Login Auth Token
gh Login Auth Token

Step 2: Generating Authentication Token

To create the authentication token, go to the following github link:

Step 3: Generating Token on GitHub

Click on Generate new Token on the tokens-page on github.

Generate Token
Generate Token

Step 4: Selecting Token Scope

To create a personal authentication token for GitHub CLI, enter a name for the token, set an expiration date, select the required scopes, and click on “Generate token”.

New Personal Access Token
New Personal Access Token

Step 5: Copy Personal Access Token

Your personal authentication token for GitHub CLI will be created. Just copy it to a secure location as it will not be displayed again.

Pa Token
Pa Token

Step 6: Provide Access Token To gh CLI

To authenticate with your personal access token on GitHub CLI, paste the token in terminal. This will log you in to your GitHub account, enabling you to use gh to interact with GitHub repositories and other resources.

Paste Pa Token
Paste Pa Token

Step 7: Done

Success! You logged in as your GitHub account.


Difference between gh & git

It’s common for newbies developer to confuse Git and GitHub CLI (gh), especially if they are new to version control or are not familiar with the GitHub platform. This can lead to confusion about the different features and functionality of each tool, and how they can be used together.

To clarify this, Git is a distributed version control system that is used for managing source code and other files, while GitHub CLI (gh) is a command-line interface for interacting with GitHub resources, such as repositories, pull requests, issues, and more.

GitHub CLI (gh) has a simpler command structure and is specifically designed to work with GitHub resources, making it easier to use for those who are newbies to the platform.

If you want to try git, you can follow this link.

But, if you prefer a graphical user interface (GUI) tool for managing Git operations, you should use GitKraken.


You can follow these official links to learn more about gh: