之前在Linux中已经生成了ssh密钥对,并且也配置好了与GitHub仓库的连接,然后想在windows上也连接一下GitHub仓库,于是把生成好的私钥先存储到windows上的一个文件夹中,接着打开git bash:
![使用已有的私钥进行GitHub验证](http://i2.51cto.com/images/blog/201801/14/b3c7f1e9a78a1131a37bd7bbceb32d0b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
然后把私钥文件移动到git的ssh目录下:
$ mv E:/git_ssh_key/id_rsa ~/.ssh$ ls ~/.sshid_rsa known_hosts
接着就可以直接进行身份验证了:
$ ssh -T git@github.comThe authenticity of host 'github.com (192.30.255.113)' can't be established.RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.Enter passphrase for key '/c/Users/admin/.ssh/id_rsa': # 你私钥的密码# 末尾显示这一段表示验证成功Hi Binary-ZeroOne! You've successfully authenticated, but GitHub does not provide shell access.