在Windows上使用Git:强制使用OpenSSH [英] Git on Windows: Force use of OpenSSH

查看:1930
本文介绍了在Windows上使用Git:强制使用OpenSSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为windows安装了git,当提供选择Putty或OpenSSH的选项时,我选择了OpenSSH。但是,我确实安装了腻子,看起来git陷入了这种情况并试图使用它。 (我在环境变量中使用了GIT_TRACE = 2)

$ $ p $ $ $ c $ E> \blah> git push
trace:built -in:git'push'
trace:run_command:'ssh''git@bitbucket.org''git-receive-pack'...
输入关键字'C:\putty\\'的密码\\ my.ppk':

这真的很奇怪,因为ppk甚至没有密码。虽然真正的问题是它不应该使用putty键,但它应该使用〜/ .id_rsa



安装后这是正常工作,但重新启动后电脑它开始这样做。



有没有办法告诉git使用openssh而不必重新安装它?

看起来git被这个

加入了

也许是因为 putty.exe 会首先出现在你的%PATH%中。



检查你的 GIT_SSH 环境变量

  set GIT_SSH 

如果你想使用openssh,你需要将其设置为 git / bin / ssh.exe

  set GIT_SSH = C:\path\to\git\bin\ssh.exe 
code>

这应该确保t push和pull命令会查找〜/ id_rsa(.pub)键,而不是查询putty *。ppk 私钥存储区。


I installed git for windows and when presented with the option to pick Putty or OpenSSH, I opted for OpenSSH. However, I do have putty installed, and it appears that git caught on to this and is trying to use it. (I have GIT_TRACE=2 in the environment variables)

E:\blah>git push
trace: built-in: git 'push'
trace: run_command: 'ssh' 'git@bitbucket.org' 'git-receive-pack '...
Enter passphrase for key 'C:\putty\my.ppk':

Which is really weird cause that ppk doesn't even have a passphrase. Though the real issue is that it shouldn't be using the putty key, it should be using ~/.id_rsa

This was working right after install, but after restarting the computer it started doing this.

Is there a way I tell git to use openssh without having to reinstall it?

解决方案

it appears that git caught on to this

Maybe because putty.exe is coming first in your %PATH%.

Check your GIT_SSH environment variable.

set GIT_SSH

If you want to use openssh, you need to set it to git/bin/ssh.exe:

set GIT_SSH=C:\path\to\git\bin\ssh.exe

That should ensure that the push and pull commands look for ~/id_rsa(.pub) keys instead of asking for a putty *.ppk private key store.

这篇关于在Windows上使用Git:强制使用OpenSSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆