Add SSH Key to GIT

Well, friends we have seen how to generate SSH Public key's in two of my previous post.  But what's use of that Public Key if you don't know how to add it to GIT.

Add your key to the ssh-agent

Step 1 :     Ensure ssh-agent is enabled:
                 eval "$(ssh-agent -s)"   (# start the ssh-agent in the background)

Step 2 :     Add your SSH key to the ssh-agent:
                 ssh-add ~/.ssh/id_rsa

Step 3 :     Add your SSH key to your account
                 Copy the SSH key to your clipboard.
                 pbcopy < ~/.ssh/id_rsa.pub   OR
                 xclip -sel clip < ~/.ssh/id_rsa.pub

Step 4 :     Add the copied key to GitHub Account:
                  4. 1   In the top right corner of any page, click your profile photo, then click Settings.
                  4. 2   In the user settings sidebar, click SSH keys.
                  4. 3   Click Add SSH key.
                  4. 4   In the Title field, add a descriptive label for the new key.
                  4. 5   Paste your key into the "Key" field.
                  4. 6   Click Add key.
                  4. 7   Confirm the action by entering your GitHub password.

Step 5 :     Test the connection
                  5. 1   Open Terminal and enter:   ssh -T git@github.com
                  5. 2   You may see this warning:
                                The authenticity of host 'github.com (207.97.227.239)' 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)?
                           Type Yes
                  5. 3   You will see following message : 
                                Hi username! You've successfully authenticated, but GitHub does not provide shell access.
                           Here, Ensure your username for git appears correctly.. if so you are done !!

                  5. 4   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).
                           In which case  Refer Following URLs :
                                https://help.github.com/articles/error-agent-admitted-failure-to-sign
                                https://help.github.com/articles/error-permission-denied-publickey

 

Add new comment