First things first, you need to create a GitHub account @ https://github.com/.
Open the Ubuntu terminal and run the following command to update/upgrade the existing packages
sudo apt-get update && sudo apt-get upgrade
and the following command to install GitHub
sudo apt install gh
In case of error, as in this case

check that the resolv.conf file is in the /etc directory
cd /etc
ls -la

If the file is missing, create it:
sudo nano resolv.conf

Add the following entries to resolv.conf file:
nameserver 8.8.8.8 nameserver 8.8.4.4
To close the file, press Ctrl + x
then y
and finally press the Enter key.
Let’s try to install GitHub again. This time the installation should be successful.
sudo apt-get update && sudo apt-get upgrade
sudo apt install gh
Create an SSH key
ssh-keygen -t rsa -b 4096

Create a config file in the ~/.ssh directory
cd .ssh
sudo nano config
The command above has created and opened the config file. Add the following entries to the config file:
# GitHub: Host github.com HostName github.com IdentityFile ~/.ssh/id_rsa_github User git
To close the file, press Ctrl + x
then y
and finally press the Enter key.
id_rsa_github is the name of the file where the ssh will be saved; you can call it whatever you like, e.g. id_rsa_github_your_username
Log in to GitHub from the Ubuntu terminal
The ssh key is added to your GitHub account at this point.
To log in, enter the following command:
gh auth login

Create an authentication token at https://github.com/settings/tokens
Once you have the token, paste it in the Ubuntu terminal to complete the login process:
