How to install and start gh on Amazon Linux 2

Samuel A Olayinka
2 min readOct 1, 2023

--

GitHub CLI is an open-source tool for using GitHub from your computer’s command line. When you’re working from the command line, you can use the GitHub CLI to save time and avoid switching contexts.

Step 1 — installing gh on Amazon Linux 2

Install package repository for immediate access to the latest releases:

type -p yum-config-manager >/dev/null || sudo yum install yum-utils
sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo yum install gh
sudo yum update gh

Step 2 — Authenticate with GitHub by running this command from your terminal.

gh auth login

Step 3 — follow the on-screen prompts.

GitHub CLI automatically stores your Git credentials for you when you choose HTTPS as your preferred protocol for Git operations and answer “yes” to the prompt asking if you would like to authenticate to Git with your GitHub credentials. This can be useful as it allows you to use git push, git pull, and so on, without needing to set up a separate credential manager or use SSH.

--

--