本文主要是介绍由于SSH配置文件的错误,导致的Permission denied (publickey)及其解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
读者如要转载,请标明出处和作者名,谢谢。
地址01:http://space.itpub.net/25851087
地址02:http://www.cnblogs.com/zjrodger/
作者名:zjrodger
(1)OS:Win7 32Bit.
(2)Git:GitHub for Windows 2.0.
下载地址:https://windows.github.com/
(3)Command Shell:Git Shell.
在Win7本地平台上安装完Github for Windows 2.0后,要在本地生成密匙,向Github上上传密匙并且进行网络连通性测试。
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默认的安装配置中,
Host github.com StrictHostKeyChecking no UserKnownHostsFile=/dev/null IdentityFile=~/.ssh/github_rsa |
①Git默认安装情况下,ssh_config配置文件中的“IdentityFile”项的值:IdentityFile=~/.ssh/github_rsa
Host * Host github.com |
方法三:
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. |
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.
|
这篇关于由于SSH配置文件的错误,导致的Permission denied (publickey)及其解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!