带有openssh密钥的TortoiseGit无法使用ssh-agent进行身份验证 [英] TortoiseGit with openssh key not authenticating using ssh-agent
问题描述
我正在Windows XP(msysGit 1.7.11,TortoiseGit 1.7.14)上设置git环境,并尝试实现以下几点:
I'm setting up a git environment on Windows XP (msysGit 1.7.11, TortoiseGit 1.7.14) and trying to achieve following points :
- 与默认22不同的端口上的ssh连接
- ssh代理处理的ssh身份验证
所以我创建了一个〜/.ssh/config 文件:
So I create a ~/.ssh/config file :
Host gitbox
User gitolite
Hostname XX.XX.XX.XX
Port 154
PreferredAuthentications publickey
IdentityFile "/c/Documents and Settings/kraymer/.ssh/id_rsa"
使用git bash CLI时,一切都会按预期进行.
When using the git bash CLI, everything works as intended.
我正在与TortoiseGit苦苦挣扎.
我首先使用Plink安装了TortoiseGit,并使用Pageant加载ssh私钥.自动身份验证(Pageant)工作正常,但设置失败,因为TortoiseGit无法识别格式为 gitolite@gitbox/repo.git 的git repos url.
I'm struggling with TortoiseGit.
I first installed TortoiseGit with Plink and using Pageant to load ssh private key. The automatic authentication (Pageant) worked but setup was a fail as TortoiseGit don't recognize git repos url formatted as gitolite@gitbox/repo.git.
然后我决定使用openssh客户端安装TortoiseGit,以便ssh客户端可以读取 config 文件,并模仿git CLI设置.
我在TortoiseGit设置中选择了msys git附带的 ssh.exe 作为ssh客户端.
在执行git pull
时,现在已解析了远程URL,但是在我希望ssh-agent自动身份验证发生时会询问密码短语.
I then decided to install TortoiseGit using openssh client, so the config file can be read by the ssh client, and to mimic the git CLI setup.
I picked the ssh.exe shipped with msys git as ssh client in TortoiseGit settings.
When doing a git pull
, the remote url is now resolved but the passphrase password is asked while I expect ssh-agent automatic authentication to occur.
是否可以使ssh-agent与TortoiseGit一起使用?
或者让TortoiseGit(Plink)了解 .ssh/config 吗?
Is it possible to make TortoiseGit work with ssh-agent ?
Or make TortoiseGit (Plink) aware of .ssh/config ?
编辑#1
按照@VonC的建议,我配置了$ HOME变量.
当我在TortoiseGit中单击显示环境变量时,我现在有了:
Following @VonC advice I configured my $HOME variable.
When I click Show environment variables in TortoiseGit I now have :
HOME=C:\Documents and Settings\kraymer
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\kraymer
但是git pull
仍然需要我输入密码.
But git pull
still require I enter passphrase.
推荐答案
无需任何调整.
只需使TortoiseGit指向git本身使用的ssh客户端,请参见屏幕截图:
Just make TortoiseGit point to the same ssh client used by git itself, see the screenshot:
这应该是Aleksey Kontsevich在评论中提到的最新版本的Git中的C:\Program Files\Git\usr\bin\ssh.exe
.
This should be C:\Program Files\Git\usr\bin\ssh.exe
in latest version of Git as mentioned by Aleksey Kontsevich in the comments.
这篇关于带有openssh密钥的TortoiseGit无法使用ssh-agent进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!