How to authenticate with GitHub using SSH


Check that there are no rsa files here before continuing, use:

ls -al ~/.ssh

If there is nothing to list (i.e. : No such file or directory) then use:

mkdir $HOME/.ssh

If there’s nothing there then generate a new keygen with:

ssh-keygen -t rsa -b 4096 -C [email protected]

Now using ls -al ~/.ssh will show our id_rsa.pub file.

Add the SSH key to the SSH agent:

eval "$(ssh-agent -s)" # for mac and Linux from bash
eval `ssh-agent -s` ssh-agent -s # for Windows

Add RSA key to SHH with:

ssh-add ~/.ssh/id_rsa

Copy your key to clipboard

clip < ~/.ssh/id_rsa.pub # Windows
cat ~/.ssh/id_rsa.pub # Linux

Go to your GitHub settings page and click the ‘New SSH key’ button paste in your generated key.

Then authenticate with:

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.