我目前正在尝试使用ssh在Windows上使用git。 我生成了一个密钥(使用ssh-keygen -t rsa)并将公钥添加到github。 不幸的是,每次我连接时出现如下内容:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for 'C:\\Users\\DaGeRe\\.ssh\\id_rsa' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: C:\\Users\\DaGeRe\\.ssh\\id_rsa Enter passphrase for C:\Users\DaGeRe\.ssh\id_rsa:
所以,为了得到这个工作,我已经完成了chmod 700(就像在无尽的post中推荐的,例如使用Git GUI或ssh-keygen的SSH私钥权限太开放 ),并且ls返回以下内容:
-rw-r--r-- 1 DaGeRe mkpasswd 951 May 20 10:59 id_rsa -rw-r--r-- 1 DaGeRe mkpasswd 239 May 20 10:59 id_rsa.pub
但不幸的是,ssh-add C:\ Users \ DaGeRe.ssh \ id_rsa或ssh -T git@github.com仍然会返回错误。 chmod命令似乎不起作用,甚至chmod -c 700 id_rsa(就像这里所说的: https : //superuser.com/questions/397288/using-cygwin-in-windows-8-chmod-600-does-not-按预期工作 )不会改变任何事情。
试图删除所有权利的窗口(由设置菜单)也不起作用。 在“属性” – >“安全”(我也从“Eigenschaften – > Sicherheit”翻译过来)中添加用户“Everyone”(德语:“Jeder”,用户可能在英语窗口中被称为不同),拒绝任何访问警告消失。
使用第一个空的密码短语,以下输出来自ssh-add:
C:\Users\DaGeRe\.ssh>ssh-add id_rsa Enter passphrase for id_rsa:
在此之后,什么都不显示。 但ssh-add -l也不返回任何内容:
C:\Users\DaGeRe\.ssh>ssh-add -l The agent has no identities.
如果我添加一个密码短语,它总是说密码错误,错误的权限(所以消息从一开始就出现)和正确的权利(所以没有出现错误,但它仍然说,正确的短语是错误的)。
我正在使用OpenSSH 3.8.1的Windows,我没有安装cygwin。
所以不知怎的,即使权利设置正确,它似乎也不会被添加。 如果有人提示如何解决这个问题,我会很高兴。
这是ssh -vT git@github.com的输出
OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004 debug1: Reading configuration data /cygdrive/c/Users/DaGeRe/.ssh/config debug1: Applying options for github.com debug1: Reading configuration data /etc/ssh_config debug1: Connecting to github.com [192.30.252.130] port 22. debug1: Connection established. debug1: identity file "/cygdrive/c/Users/DaGeRe/.ssh/id_rsa" type -1 debug1: Remote protocol version 2.0, remote software version libssh-0.6.0 debug1: no match: libssh-0.6.0 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-sha1 none debug1: kex: client->server aes128-cbc hmac-sha1 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /cygdrive/c/Users/DaGeRe/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: "/cygdrive/c/Users/DaGeRe/.ssh/id_rsa" debug1: No more authentication methods to try. Permission denied (publickey).
经过一番尝试之后,我发现了一个解决这个问题的办法,使用了windows并运行git:使用Putty代替OpenSSH。
一个必须设置GIT_SSH到Plink(在我的情况下SET GIT_SSH = C:\ PortablePrograme \ putty \ PLINK.EXE),并开始pagent如下所述: http ://guides.beanstalkapp.com/version-control/git-on- windows.html (如果有一个ssh-key,已经创建并添加到例如github,可以通过转换将其转换为putty格式,而不是创建新的密钥)。
我想这只是一个可能的解决方案,我很乐意听到有人有另一种解决方案。