MSysGit和ssh配置。失踪

时间:2012-04-12 11:15:18

标签: windows git ssh msysgit

1)运行Git Bash(C:\ Program Files(x86)\ Git \ bin \ sh.exe --login)

$ ssh -v git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/Alexander Fedorov/.ssh/config
debug1: Applying options for github.com
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
...
Hi xpoft! You've successfully authenticated, but GitHub does not provide shell access.
...

好! ssh config读得很好。

2)从cmd.exe运行

C:\Users\Alexander Fedorov>ssh.exe -v git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [207.97.227.239] port 22.
...
debug1: No more authentication methods to try.
Permission denied (publickey).

拿去。 ssh配置文件丢失了......

如何...如何从ssh.exe读取配置?

1 个答案:

答案 0 :(得分:10)

可能缺少的是用户环境变量HOME

如果从msysgit打包的git-cmd.bat脚本启动DOS会话,则应该定义它,您应该看到%HOME%\.ssh\id_rsa(.pub)

但是在任何其他DOS窗口中,默认情况下都没有定义HOMEHOMEPATHUSERPROFILE)。
另请参阅“Fix msysGit Portable $HOME location”作为示例(但您不需要使用最新版本的msysgit及其git-cmd.bat脚本进行解决方法)