Git can't find .ssh

╄→尐↘猪︶ㄣ 提交于 2019-12-03 06:48:53

Found it!

The problem is that there are two different git commands, git.exe (the actual program) and git.cmd (which sets up the necessary stuff for it to work on Windows). Depending on what options you set at install time, you can end up with a scenario where the former rather than the latter is the one that ends up in your path, so it doesn't work. Then the usual debugging suggestions regarding ssh.exe don't work unless you've run git.cmd.

In a nutshell, just make sure you're running git.cmd instead of git.exe.

Simon Dean

Oddly msysgit has it's own .ssh directory:

C:\Program Files (x86)\Git\.ssh

Placing your ssh key there should work. It solved the problem for me

I had this problem with git in Msys/MinGW where it couldn't find my private key, despite being able to ssh into the server fine.

The problem was that the entry in ~/.ssh/config said:

Host github.com
IdentityFile /home/username/.ssh/id_rsa

However Git required the full path from a Windows point of view like this instead:

Host github.com
IdentityFile c:/mingw/msys/1.0/home/username/.ssh/id_rsa

and then it worked.

To discover this path from msys, run cd ~/.ssh and then pwd -W

The windows way is to import your ssh key to putty and use putty agent.

Our admins changed the HOMEDRIVE on Windows and afterwards tools like ssh did no longer find their config anymore. Seems like HOMEDRIVE is used as default value for HOME.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!