当我推送代码到Github时,为什么总是要求输入我的SSH密码?

3
一些事实:
  • 我使用Windows 10操作系统
  • 我使用Power Shell和PoshGit (我不想使用cygwin bash shell或其任何衍生版本)
  • 我的存储库都是git@...,即它们不使用https远程
  • 当我启动新的shell会话时,如果尚未运行,则ssh-agent启动并提示我输入密码,然后保留以供后续会话使用
  • 我已确认ssh-agent在后台运行
  • 我的id_rsa文件存在于保存的身份列表中(ssh-add -l),这是连接到github存储库时提示我输入密码的密钥文件
  • 我也尝试了github的帮助页面建议, 具体来说:git config --global credential.helper wincred- 它没有起作用。

我找到的所有教程或建议都无法阻止ssh每次推送/拉取等操作时要求输入密码。

任何帮助将不胜感激。

编辑

为了更好地理解,Scott Haack的旧文章介绍了这应该如何工作(尽管对我来说似乎不起作用):http://haacked.com/archive/2011/12/19/get-git-for-windows.aspx/ 编辑 ssh -vvvT git@github.com verify 生成以下内容(相关代码片段):
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007                 
debug1: Reading configuration data /etc/ssh/ssh_config    
debug2: ssh_connect: needpriv 0                           
debug1: Connecting to github.com [192.30.252.130] port 22.
debug1: Connection established.                           
debug1: identity file /c/Users/xxxxx/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/xxxxx/.ssh/id_rsa.   
debug2: key_type_from_name: unknown key type '-----BEGIN' 
debug3: key_read: missing keytype                         
debug2: key_type_from_name: unknown key type 'Proc-Type:' 
debug3: key_read: missing keytype                         
debug2: key_type_from_name: unknown key type 'DEK-Info:'  

我移除并重新添加了我的密钥文件,然后被提示输入密码:

D:\> ssh-add -D 
All identities removed.
D:\> ssh-add ~/.ssh/id_rsa
Enter passphrase for /c/Users/xxxxx/.ssh/id_rsa:
Identity added: /c/Users/xxxxx/.ssh/id_rsa (/c/Users/xxxxx/.ssh/id_rsa)
D:\> ssh-add -l 
2048 05:d5:8f:f8:e5:41:66:90:4c:a1:03:93:9d:e5:18:10 /c/Users/xxxxx/.ssh/id_rsa (RSA)

私钥文件看起来像这样(显然删除了私人细节):
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,xxxxxxxxxxxxxxxx

............etc.==
-----END RSA PRIVATE KEY-----

我不知道为什么它在添加时是一种方式,然后在尝试读取时变得困惑。 编辑 根据评论和已接受的答案,我的路径指向一个非常过时的bin文件夹,其中包含我正在使用的ssh-agent、ssh-add(更不用说keygen了)。修复这个问题,生成一个新的密钥,并将路径指向正确的、更新的git bin文件夹已解决这个问题。

Enter passphrase for key '/c/Users/*******/.ssh/id_rsa': - Nathan Ridley
@kjo感谢您的回复,但我建议您重新阅读我的要点...您的评论表明您只看了标题...? - Nathan Ridley
你安装了wincred助手文件吗?你尝试过执行git config --global ghfw.disableverification true吗? - Harald F.
@CmdrTchort 刚刚尝试了一下... 没成功。我认为凭据管理器仅适用于用户名/密码组合,无法用于ssh身份验证。 - Nathan Ridley
@NathanRidley:我道歉。 - kjo
显示剩余9条评论
1个回答

1
一些指南指向了非常古老的openssh版本(是的,当前版本是7.1p1):

OpenSSH_4.6p1,OpenSSL 0.9.8e 2007年2月23日

而且密钥看起来也非常古老(我希望没有人在生产中再使用DES):

DEK-Info: DES-EDE3-CBC,xxxxxxxxxxxxxxxx

确保您的PATH中有更近期的内容。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接