F:\Workspaces\Github_Workspace> ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of know
n hosts. Permission denied (publickey).
如上所述,Github for Windows 2.0在默认安装情况下,SSH的的配置文件ssh_config中的“IdentityFile”项的值与实际新创建的密匙全路径名不相符,结果导致本地的SSH工具无法找到到正确的密匙,进而无法同已经上传到Github密匙相匹配,结果就出现了“Permission
denied (publickey)”这样的错误。
If it says "Permission denied (publickey)" you willhave to put in a passphrasefor your key. Do not be tempted to just press
enter...this was what worked for me...it took me five hours to realize that pressing enter made OpenSSH feel that your key was too public so that is why it is denying you from going to the next step.
So as mentioned in prior answers, the Permission denied error in Windows is because you are trying to use a key other than id_rsa.
Windows lacks the bells and whistles that Linux and Mac have to try out all your public keys when trying to connect to a server via SSH. If you're using the ssh command, you can tell it which key to use by passing the -i flag
followed by the path to the key to use:
F:\Workspaces\Github_Workspace> ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of know
n hosts.
Permission denied (publickey). F:\Workspaces\Github_Workspace> ssh -i ~/.ssh/id_rsa git@github.com
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of know
n hosts.
Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':
Hi zjrodger! You've successfully authenticated, but GitHub does not provide shel
l access.
Connection to github.com closed.