在使用git和tortoisegit时,Windows XP上的认证失败

3

我的身份验证一直失败。我已经创建了SSH密钥,并且公钥已经被本地git管理员导入,但我仍然会被提示输入密码:

git.exe clone  --progress -v  "git@repo:project.git" "C:\web\project"  
Cloning into C:\web\project...  
git@repo's password:  
fatal: The remote end hung up unexpectedly
  • 我的SSH密钥没有密码,并存储在"C:\Documents and Settings\username\.ssh"下,为了保险起见,我还将它们复制到了"C:\Documents and Settings\username\ssh"(没有前面的点)。
  • 在Windows环境变量屏幕上,HOME系统变量设置为我的用户正确的目录。
1个回答

1

ssh -vvv git@repo 返回什么?

只要这个 ssh 请求不起作用,就无法使用 git@repo 服务器进行任何 git 操作。
如果 ssh 报告它尝试提供公钥,则必须仔细检查它是否已正确添加到 repo 服务器上的 ~git/.ssh/authorized_keys 文件中。

以下是一个有效的 ssh 会话示例摘录:

debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /p/.ssh/mypubkey
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp f8:d9:7...:cf

debug3: sign_and_send_pubkey
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.

两个注释:

  • 我的%HOME%引用不是%HOMEDIR%,而是一个自定义驱动器(p:\),这是在工作中的本地约定,可能不适用于您。
  • 我的公钥/私钥名称不遵循默认标准(id_rsa.pub/id_rsa

我已经在%HOME%\.ssh目录中添加了一个config文件,以明确命名公钥文件:

host gitrepo
     user git
     hostname repo
     identityfile ~/.ssh/mypubkey

这样,我只需要输入:ssh gitrepo,ssh 就会知道要使用哪个用户、主机名和公钥的完整路径。

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