Windows – Change where SSH looks for key files on Windows

gitsshwindows

By default, my ssh looks for private key identities in /.ssh/ when I connect. However, this is not a valid place in a Windows system. How can I permanently change the default place that it looks for the private key identities, so I don't need to run ssh-add every time I want my keys?

Note: I got SSH when I installed mysysgit, the Windows version of Git (which comes with all the ssh executables in its /bin directory). I think it looks in this place because it expects me to use the MinGW git bash it comes with. However, I want to work from the cmd.exe prompt so I need it to look in a valid Windows folder.

Best Answer

  • ssh from OpenSSH normally uses ~/.ssh/, where ~ represents your home directory. To make it work on Windows, set the HOME environment variable apropriately.

    set HOME=%USERPROFILE%
    
    set HOME=C:\Users\babonk