Hello Friends, Again I am here with new tutorials which will help you to generate SSH key pair and configure on github.

What is SSH Key?

In short SSH keys are a way to identify trusted computers, without involving passwords.

Below steps will help you to generate and configure ssh key on your github account.

I assumed that open ssh already installed in your system.

Step-1: Check for your .ssh folder in your home directory if not exists please create one.

find .ssh

Step-2: Go to your .ssh directory Run below command to generate SSH Key.

cd .ssh
ssh-keygen -t rsa -b 4096 -C "iamrohitx@gmail.com"


After hitting this command you need to answer some questions like

Enter file in which to save the key (/home/rohit/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:

But that questions are not mandatory you can skip by hitting enter key. It’ll create default private and public key for you Or you can choose your custom key name by first question, You only need to enter your custom key name and hit enter for example..

Enter file in which to save the key (/home/rohit/.ssh/id_rsa): github_key

Step-3: Open your public key using command line editor and copy.

nano id_rsa.pub 
vim id_rsa.pub

Now Copy the SSH key to your clipboard. Keep in mind that your key may also be named id_rsa.pub

Step-4: I assumed that you already have github account if not then create one.

Step-5: Login into your github account and In the top right corner of page, click your profile photo, then click Settings.

Step-6: In the user settings sidebar, click SSH keys

Step-7: Click on Add SSH key.

Step-8: In the Title field, add a descriptive label for the new key. For example, I am using my personal computer i named Rohit-PC.

Step-9: Paste your key into the “Key” field.

Step-10: Click Add key. It may ask your github account password for confirmation.

Step-11: Now time to test your connection.
To make sure everything is working, you’ll now try to SSH into GitHub. When you do this, you will be asked to authenticate this action using your password, which is the SSH key passphrase you created earlier.

Open Terminal and enter:

ssh -T git@github.com

You may see this warning:

The authenticity of host 'github.com (' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

Verify the fingerprint in the message you see matches the following message, then type yes:

Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.
Hi hiiamrohit! You've successfully authenticated, but GitHub does not provide shell access.

It’s possible that you’ll see this error message:

Agent admitted failure to sign using the key.
debug1: No more authentication methods to try.
Permission denied (publickey).
This is a known problem with certain Linux distributions. For a possible resolution, see our help article.

Thanks, Hope this tutorial will help you to understand SSH key generation and configuration.

If you like this post please don’t forget to subscribe My Public Notebook for more useful stuff.