我可以在Mac和Linux机器上使用SSH密钥和Moovweb凭据进行身份验证、生成和推送等操作。
然而,在我的Windows机上,使用Git Bash时,我得到了一个SSH Permission denied (publickey)错误。错误消息如下:
$> moov generate 123dsfsdsf nytimes.com
Running environment checks.
Verifying that git is installed...OK
Checking that current 123dsfsdsf directory doesn't exist...OK
Registering project with MoovCloud.
Authenticating with MoovCloud.
Checking for git access...Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
FAILED
> Need to upload an ssh key in order to generate a project...
Found the following SSH public keys:
1 ) id_rsa.pub
2 ) new_rsa.pub
Which would you like to use with your Moovweb account? 2
Uploading public key...
Successfully uploaded public key new_rsa.pub as 'firstname.lastname@GGT.local'
You are now ready to push projects to MoovCloud!
Creating project in MoovCloud...OK
Generating files...OK
Cloning project locally.
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Cloning into '123dsfsdsf'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ERROR: Error cloning git repo: exit status 128
Please try cloning the repository (git clone moov@git.moovweb.com:firstnameglastname/123dsfsdsf.git) again later.
Try 'moov help generate' to find out details.看起来像是Windows特定的SSH错误。有什么解决方法吗?
发布于 2013-06-30 14:18:13
因此,正如在前面的答案中所提到的,Windows中的Permission denied错误是因为您正在尝试使用id_rsa以外的密钥。
Windows缺少Linux和Mac在尝试通过SSH连接到服务器时必须尝试所有公钥的花哨功能。如果您使用的是ssh命令,您可以通过传递-i标志,后跟要使用的密钥的路径来告诉它要使用哪个密钥:
ssh -i ~/.ssh/moovweb_rsa moov@git.moovweb.com如果您已经(通过moov login命令或控制台UI)将moovweb_rsa.pub上传到控制台,则上述命令应该可以正常工作。然而,尝试任何与git相关的命令都应该失败,因为Git不能让您选择在连接到git remote时使用哪个密钥。因此,SSH被强制使用缺省密钥id_rsa,如果该密钥不起作用(或不存在),则连接将失败,并显示permission denied错误。
正如其他答案中所建议的,一种可能的解决方案是简单地将密钥重命名为id_rsa。对于大多数人来说,这是一个很好的解决方案。但是,如果您已经拥有id_rsa密钥,并且希望在Moovweb中使用不同的密钥,则可以通过添加以下内容来编辑~/.ssh/config文件:
Host git.moovweb.com
IdentityFile ~/.ssh/moovweb_rsa如果您将以上几行添加到您的~/.ssh/config文件中(如果它不存在,则创建它),您应该能够成功地让Git与Moovweb远程git服务器通信。配置基本上告诉SSH,对于给定的主机(git.moovweb.com),SSH应该使用给定的密钥,而不是默认密钥。
这在所有的Git遥控器上都是毫无价值的;与Github,Heroku等的交互……在Windows中也会遇到这个问题。如果您愿意,您可以很容易地扩展您的~/.ssh/config文件,为每个服务使用单独的SSH键:
Host git.moovweb.com
IdentityFile ~/.ssh/moovweb_rsa
Host github.com
IdentityFile ~/.ssh/github_rsa
Host heroku.com
IdentityFile ~/.ssh/heroku_rsa发布于 2013-06-30 02:20:50
快速解决方案:仅使用默认的id_rsa.pub密钥
一些注意事项:
请确保您输入了正确的通向id_rsa.pub
事实证明,Windows Git Bash并没有提供Mac/Linux用户所习惯的所有很酷的实用程序。具体地说,您没有运行ssh-agent来帮助处理多个键。如果没有ssh-agent,git命令似乎只使用默认的id_rsa.pub密钥。
您可以验证这是Github's awesome SSH troubleshooting guide之后的SSH/Windows问题。无论您尝试连接到哪个SSH/Git服务器,都会得到一个Permission denied (publickey)。
https://stackoverflow.com/questions/17383177
复制相似问题