Could not create directory '/home/username/.ssh'

Viewed 42128

Git suddenly stopped working for me. (I use Git Bash under Windows 7. I am not using Cygwin.)

Every time I try to pull or push it says:

Could not create directory '/home/sigod/.ssh'

My SSH keys located in C:\Users\sigod\.ssh and HOME set to /c/Users/sigod. Which should work according to various SO questions.

If I place SSH keys into C:\Program Files\Git\home\sigod\.ssh then Git starts working again. But how can I make it work without dirty solutions?

6 Answers

Windows Machine

you can use cd ~/.ssh/ instead of ~/.ssh

cd ~/.ssh/

Same thing here: Could not create directory '/home/carlos.leao/.ssh', in Git Bash for Windows, version 2.17.1.2-64-bit. Using Windows 10.

Solve with sigod workaround. But insted of create the folder struture C:\Program Files\Git\home\carlos.leao and copied the folder C:\Users\carlos.leao.ssh into it i've created a symbolic link from C:\Users\carlos.leao.ssh to C:\Program Files\Git\home\carlos.leao.ssh. To do it (replace carlos.leao with your Windows username):

  1. Create this folder struture C:\Program Files\Git**home\carlos.leao**
  2. start CMD.exe
  3. run the comand: mklink /d "C:\Users\carlos.leao.ssh" "C:\Program Files\Git\home\carlos.leao.ssh"

Works like a charm!

Make sure which one [ssh.exe] you are executing ! $ where ssh

D:\xxxx\bin\ssh.exe
C:\Program Files\Git\usr\bin\ssh.exe
C:\Windows\System32\OpenSSH\ssh.exe

In my case, there is another ssh.exe in my export Path. (i.e.: D:\xxxx\bin\ssh.exe)

So I remove the the ssh.exe and keep the original one! (C:\Program Files\Git\usr\bin\ssh.exe)

Everything is nice now!

Reinstalling git-bash worked for me.

Related