Install GitHub CLI on Raspberry Pi

GitHub CLI is a tool that enables to login to GitHub account via command line and manage pull requests, issues, releases, gists, and other GitHub actions.

This tutorial demonstrates how to install GitHub CLI on Raspberry Pi.

Install GitHub CLI

Use SSH to connect to Raspberry Pi. Retrieve the latest version tag of GitHub CLI release and assign it to variable.

GITHUB_CLI_VERSION=$(curl -s "" | grep -Po '"tag_name": "v\K[0-9.]+')

Navigate to your home directory and download the .deb package from releases page of the GitHub CLI repository.

cd ~
curl -Lo gh.deb "${GITHUB_CLI_VERSION}_linux_armv6.deb"

Run the following command to install GitHub CLI:

sudo dpkg -i gh.deb

Once installation is completed, GitHub CLI will be available with gh command. We can check version:

gh --version

We can remove .deb package because it is no longer needed.

rm -rf gh.deb

Testing GitHub CLI

In order to use the GitHub CLI we need to create token. Sign in to GitHub and go to settings page. Generate a new personal access token or use existing token.

Create a new text file to store token.

echo 'YOUR GITHUB API TOKEN' > github_token.txt

Execute the following command to login to GitHub account:

gh auth login --with-token < github_token.txt

We can view authentication status as follows:

gh auth status

Now we can perform various GitHub actions. For example, the following command retrieves a list of repositories owned by Google:

gh repo list google

If you want to log out of a GitHub, use this command:

gh auth logout

Uninstall GitHub CLI

If GitHub CLI is no longer needed, you can remove it with command:

sudo dpkg -r gh

You can also remove GitHub CLI configuration:

rm -rf ~/.config/gh

Leave a Comment

Your email address will not be published. Required fields are marked *