【问题标题】:Auth fails on Windows XP with git and tortoisegit使用 git 和 tortoisegit 在 Windows XP 上进行身份验证失败
【发布时间】:2011-07-16 04:06:57
【问题描述】:
我的身份验证不断失败。我已经创建了我的 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 系统变量设置为我的用户的正确目录。
【问题讨论】:
标签:
windows
git
ssh-keys
openssh
tortoisegit
【解决方案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.
两个cmets:
- 我的
%HOME% 参考不是%HOMEDIR%,而是自定义驱动器 (p:\),这是当地的工作惯例,可能不适用于您。
- 我的公钥/私钥的名称不符合默认标准 (
id_rsa.pub/id_rsa)
我在%HOME%\.ssh 目录中添加了一个config 文件,以便明确命名公钥文件:
host gitrepo
user git
hostname repo
identityfile ~/.ssh/mypubkey
这样,我只需输入:ssh gitrepo,ssh 就会知道要使用哪个用户、主机名和公钥的确切完整路径。