Using Github with SSH keys
GitHub removed support for Password Authentication while using HTTPS protocol in August 2021. It is convenient (and recommended) to access repos securely using SSH keys.
Generate a public/private RSA key pair
Skip to next step if you have an existing SSH key pair.
Run the ssh-keygen
command with default arguments to generate and replace your private keypair.
ssh-keygen -t rsa
You will be prompted to provide a filename and an additional password if required.
The output will look like this:

Copy the public key
Use the terminal to display the public key, highlight, and copy to clipboard.
The public key will have a .pub file extension. You should never share your private key!
$ cd $HOME/.ssh
$ cat id_rsa.pub
The output will look similar to the following:

Save the public key to GitHub
Navigate to 'Settings' under your GitHub profile. In the Left navigation select 'SSH and GPG keys':

Select 'New SSH key', add a title with any descriptive name, and paste the public key into the Key textarea:

Your repos will now show clone commands using SSH:

Last updated