在 Windows XP 上使用 git 和 tortoisegit 进行身份验证失败
我的身份验证总是失败。我已经创建了 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
系统变量已设置为我的用户的正确目录。
My authentication keeps failing. I've created my SSH keys and the public key has been imported by the local git admin, but I still get prompted for a password:
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
- My SSH keys are passphraseless and live under "
C:\Documents and Settings\username\.ssh
" and I also copied them to "C:\Documents and Settings\username\ssh
" (without the preceding dot) just for good measure. - In the Windows environment variables screen, the
HOME
system var is set to the correct directory for my user.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ssh -vvv git@repo
返回什么?只要此 ssh 请求不起作用,
git@repo
服务器就无法进行任何 git 操作。如果 ssh 报告它确实尝试提供公钥,那么您必须仔细检查它是否已正确添加到存储库服务器上的
~git/.ssh/authorized_keys
文件中。以下是有效的 ssh 会话示例摘录:
两条注释:
%HOME%
引用不是%HOMEDIR%
而是自定义驱动器 (p:\
),这是工作中的本地约定,可能不适用于您。id_rsa.pub
/id_rsa
)我已在以下位置添加了一个
config
文件%HOME%\.ssh
目录,以便显式命名公钥文件:这样,我可以简单地键入:
ssh gitrepo
,然后 ssh 就会知道哪个用户,要使用的公钥的主机名和确切完整路径。What does
ssh -vvv git@repo
returns?As long as this ssh request doesn't work, no git operation will work with the
git@repo
server.And if the ssh reports it is does try to offer the publickey, then you must double-check it has been correctly added to the
~git/.ssh/authorized_keys
file on the repo server.Here is an extract of example of a ssh session which works:
Two comments:
%HOME%
reference not%HOMEDIR%
but a custom drive (p:\
), this is a local convention at work and might not apply to you.id_rsa.pub
/id_rsa
)I have added a
config
file in the%HOME%\.ssh
directory in order to name explicitly the public key file:That way, I can simply type:
ssh gitrepo
, and ssh will know which user, hostname and exact full path of the public key to use.