Win7 Git Permission denied (publickey)

在Win7上安装git后,用ssh -T git@github.com 测试,报错:Permission denied (publickey),谷歌了很多文章,有说着说那的,感觉都不是很靠谱,最后发现了这个答案:

Using Windows 8 to setup your ssh and Github

If it says "Permission denied (publickey)" you will have to put in a passphrase for 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.
If it says "The authenticity of host 'github.com (203.232.175.90)' can't be established." Then you will have to go through the process shown here: [Google] (https://help.github.com/articles/error-permission-denied-publickey.)
Go to the part that says "Verify the public key is attached to your GitHub account". You want to start with the part that says account. (I am assuming you already have an account.

Also, you want to be in C:\RailsInstaller\Git.ssh and when I did 'dir' I noticed that I had '.', '..', 'known_hosts'. I had to get a new key by doing the following (I found this on the Github site):

"ssh-keygen -t rsa -C "your_email@example.com" # 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]"
And pay attention to the file where the key will be saved. Do not just press enter.. my one showed "(//.ssh/id_rsa)" I had to type "/.ssh/id_rsa" to make sure it was in the right directory.

And you should be able to type ssh in the command line. If you cannot do that you will have to add it to your path.


按照上面的方法解决了问题,如下结果:




原文链接:http://stackoverflow.com/questions/2127104/permission-denied-publickey-error-using-git-on-windows-7

相关文章
相关标签/搜索