之前在Linux中已經生成了ssh密鑰對,並且也配置好了與GitHub倉庫的連接,然後想在windows上也連接一下GitHub倉庫,於是把生成好的私鑰先存儲到windows上的一個文件夾中,接着打開git bash:
然後把私鑰文件移動到git的ssh目錄下:
$ mv E:/git_ssh_key/id_rsa ~/.ssh
$ ls ~/.ssh
id_rsa known_hosts
接着就可以直接進行身份驗證了:
$ ssh -T [email protected]
The 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)? yes
Warning: 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.