If not already installed, install Git using the following code in Terminal:
sudo apt install git
It is possible to install git-all instead of git, but if working in just the console git is sufficient as well has being a significantly more lightweight package.
If a SSH key has not already been generated, this can be done using the following code in Terminal:
ssh-keygen -t -rsa
Log into the GitHub website and go to Settings then SSH and CPG keys, copy and paste here the generated public key found in your id_rsa.pub file.
Test the SSH connection using the following code:
ssh -T git@github.com
SSH access to GitHub is working correctly if you are met with the message: “Hi USERNAME! You’ve successfully authenticated, but GitHub does not provide shell access.”.
The name and email address used for commits also needs to be configured using the following code in Terminal, (replacing FULL_NAME with your name (not username), and EMAIL with your email address):
git config --global user.name "FULL_NAME"
git config --global user.email "EMAIL"
The configuration can be checked using the following code:
git config --global user.name
git config --global user.email
A repository can now be cloned using SSH, visit the repository on the GitHub website and click Clone or Download, if it is not already set to SSH click Use SSH then copy and paste the SSH link provided into the code below:
git clone ssh://git@github.com/username/repo.git
The repository should now be cloned and ready to use.
Source:
https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/#platform-linux
https://help.github.com/articles/setting-your-username-in-git/
https://help.github.com/articles/setting-your-commit-email-address-in-git/
https://help.github.com/articles/cloning-a-repository/