When you add SSH key to your GitHub account in a Windows environment, you need to execute the following command in Git Bash :
First step: Check the existing SSH keys
$ ls-al ~/.ssh
Step two: Generate a new SSH key
$ ssh-keygen-t rsa-c "[email protected]" # Creates a new SSH key, using the provided email as a label# generating public/ Private RSA key pair.# Enter file in which to save the key (/C/USERS/YOU/.SSH/ID_RSA): [Press Enter]enter Passphrase (empt Y for no passphrase): [Type a passphrase]# Enter same passphrase again: [Type passphrase again]
You will then get the following hints:
Your identification have been saved in/c/users/you/.ssh/id_rsa.# Your public key have been saved In/c/users/you/.ssh/id_rs a.pub.# the key fingerprint is:# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]
The new key is then added to the ssh-agent:
$ ssh-agent-s# Agent pid 59566$ Ssh-add ~/.ssh/id_rsa
* Note: If an error is displayed when executing ssh-add Could not open a connection to your authentication agent. Then execute
Eval ' ssh-agent-s '
then re-execute the ssh-add command.
Step three: Add SSH key to your GitHub account
First copy the public key to the Pasteboard:
$ clip < ~/.ssh/id_rsa.pub# Copies the contents of the Id_rsa.pub file to your clipboard
Or it can be solved with text editing tools.
Then in the top right corner of the GitHub account page, click Configure (settings, gear graphics), click "SSH Keys" in sidebar, then click "Add ssh Key", enter a title you like in the "title" field, "key" Bar to paste the public key that you just copied, and then click the "Add Key" button.
Fourth step: Check if SSH key is set successfully
$ ssh-t [email protected]# attempts to ssh to GitHub
You may see the following 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.# is sure you want to continue connecting (yes/no)?
Enter "Yes" and if you get the following result, your settings are successful!
Hi username! You ' ve successfully authenticated, but GitHub does not# provide shell access.
Http://www.cnblogs.com/Security-Darren/p/4106328.html
(diagnostics) "Could not open a connection to your Authentication agent" error when adding SSH key to GitHub (go)