Set up the GitHub command line interface (CLI) tool on Linux Mint 21 vanessa
Github CLI
The GitHub Command Line Interface (CLI) tool, often referred to as gh
, is a command-line tool provided by GitHub for interacting with GitHub repositories and performing various GitHub-related actions directly from the command line.
With the GitHub CLI, you can perform tasks such as creating repositories, managing issues and pull requests, viewing repository information, and more, all without having to use a web browser.
The GitHub CLI is designed to streamline workflows for developers who prefer working in a terminal environment.
Let's get down to business
shall we?
Solution
Check your OS
This step is just to make sure you have Linux Mint or a Ubuntu-based Linux distribution.
cat /etc/os-release
lsb_release -a
uname -a
hostnamectl
Output
Open the terminal
You can open a terminal by pressing Ctrl + Alt + T or by searching for "Terminal" in the application menu.
Add a GPG key to the system's keyring
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
Output
Brief explanation
The apt-key
command is used for managing authentication keys used to authenticate packages.
adv
: This stands for "advanced."
--keyserver
keyserver.ubuntu.com
: This specifies the key server from which to receive the GPG key. In this case, it's the Ubuntu key server.
--recv-key C99B11DEB97541F0
: This specifies the GPG key's identifier that should be retrieved from the key server. The GPG key is a cryptographic key used to sign packages, and this command fetches and adds that key to the system's keyring.
Add a new repository
sudo apt-add-repository https://cli.github.com/packages
Install
sudo apt-get install gh
Output
Verify installation
gh --version
which gh
Output
Initiate authentication process
Before using gh
, you need to authenticate with your GitHub account. Run the following command and follow the prompts:
gh auth login
Output
Choose preferred protocol
I picked up SSH
.
Upload the SSH public key
I picked up my current SSH public key.
Authenticate
I used the `authentication token `.
Check
You can check if you are really logged in by trying to authenticate again.
gh auth login
Output
Done
Celebrate
Well-done. You did a great job!
Let's connect
Final thoughts
Thank you for reading this article.
If you have any questions, thoughts, suggestions, or corrections, please share them with us.
We appreciate your feedback and look forward to hearing from you.
Feel free to suggest topics for future blog articles. Until next time!