First: check if SSH exists (Ls-al ~/.ssh)
$ ls-al ~/.sshLists the files in your. SSH directory, if they exist
Second: Generate a new SSH key (ssh-keygen-t rsa-c "[email protected]")
$ ssh-keygen-t rsa-c "[email protected]"creates a new SSH key, using the provided email as a labelGener ating public/private RSA key pair. Enter file in which to save the key (/c/users/you[press Enter]
[Type a passphrase] [press ENTER]
[Type passphrase again] [press ENTER]
The resulting results are as follows:
Your identification have been saved in/c/users/you/.ssh/id_rsa. Your Public key have been saved in/c/users/you/.ssh/id_rsa.pub. The key fingerprint is:01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]
Add a new key to Ssh-agent:
$ ssh-agent-sAgent PID 59566$ ssh-add ~/.ssh/id_rsa
If could not open a connection to your authentication agent appears
Workaround:
$ eval $ (ssh-agent)
Agent PID 59566
Ssh-add ~/.ssh/id_rsa
Identity added:/c/users//.ssh/id_rsa(/c/users/you/.ssh/id_rsa)
Third: Add SSH key to GitHub
$ clip < ~/.ssh/id_rsa.pubCopies the contents of the Id_rsa.pub file to your clipboard
As shown in the following:
IV: Check if no configuration is successful
In Git bash, enter:
$ ssh-t [email protected]attempts to ssh to GitHub
May appear:
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 you sure want to continue connecting (yes/no)?
This is normal, enter Yes
username! You've successfully authenticated, but GitHub does notprovide shell access.
V: Change the git remote URL: convert https://github.com/xxxx.git to [email protected]:xxxx.git
That is, modify the. git/config file
Article excerpt from: Https://help.github.com/articles/generating-ssh-keys
Windows git ssh key for GitHub