How to get SSH keys and add them to your GitHub account

Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

You might have seen a message above recently. The GitHub announced that they will no longer accept account passwords when authenticating Git operations on GitHub.

Because of that, you need to add SSH keys to your GitHub account to use GitHub services properly.

In this post, I will briefly show you what SSH is and how to get SSH keys and add them to your GitHub account.

What SSH is

SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network.

SSH provides a secure channel over an unsecured network so that sensitive information, notably passwords, transmitted over the network is secured from malicious people who try to steal your information through packet analysis.

How to generate SSH keys

It's quite simple. All you need to do is type command below in your terminal.

$ ssh-keygen -t rsa -b 4096 -C "your@email.com"

You need to substitute "your@email.com" with your actual email address.

Adding SSH keys to your GitHub account

First, you need to copy a generated public SSH key to the clipboard.

$ cat ~/.ssh/id_rsa.pub

Select output and copy it to the clipboard.

Then, go to your settings page and click the "New SSH key" button.

Finally, paste your public SSH key, give it a recognizable title, and click "Add SSH key" button.

That's it! You've just successfully added SSH key to your GitHub account.