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.
Step-2: Go to your .ssh directory Run below command to generate SSH Key.
cd .ssh ssh-keygen -t rsa -b 4096 -C "[email protected]"
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 OR 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-6: In the user settings sidebar, click SSH keys
Step-9: Paste your key into the “Key” field.
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 [email protected]
You may see this warning:
The authenticity of host 'github.com (22.214.171.124)' 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,126.96.36.199' (RSA) to the list of known hosts. Hi hiiamrohit! You've successfully authenticated, but GitHub does not provide shell access.
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.