Github SSH Key

The struggling Developer
4 min readJan 26, 2021
Photo by Richy Great on Unsplash

Problem

Password authentication with Github is being deprecated. The tools you use make problems for you? You have multiple GitHub Accounts that you need to configure. Let´s do it with Github SSH Keys.

Solution

The Solution are using SSH Keys with Github. Let´s do it correct from the beginning, so that you can have multiple Keys and accounts on your System:

  • Create SSH Key
  • Announce your public SSH Key to Github
  • Configure SSH
  • Configure your local repository

Create SSH Key

To create an SSH Key, you use ssh-keygen -t rsa -f $path.

$path is the path were to save the key and it´s name, so e.g. ~/.ssh/myPrivateGithubSSHKey.

Announce your public SSH Key to Github

After the key was created, you need to announce the key to Github. To do that go to Github.com and click on the profile icon on the top right:

Click on Settings. In the opening window click on SSH and GPG Keys:

You should see this:

Click on “New SSH Key”. You should see this:

In the Title put a description that reminds you where your GitHub SSH Key is coming from (especially in case there was a breach on one of your Systems and you need to disable/remove it)

In the Key field you put the copied content of the key you generated, from the .pub file. So if you created a key myPrivateGithubSSHKey, you copy the content of myPrivateGithubSSHKey.pub.

That looks like this:

The exact content will differ, but you can compare that the format matches. If the key…