I have just installed a fresh MinGW installation on Windows 7 64bit using the Graphical User Interface Installer (the recommended approach) following the instructions given here and keeping the default options (i.e. installation in C:\MinGW) – hopefully without missing any steps or messing things up in any way.
However, when running the ssh command, I get the following error:
C:\Users\myusername>ssh username@host
Could not create directory '/home/myusername/.ssh'.
The authenticity of host 'host (host-ip)' can't be established.
RSA key fingerprint is fingerprint.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/myusername/.ssh/known_hosts).
So, I basically have to confirm the connection every time.
Why does this happen and how do I fix it?
Best Answer
After some trial and error, I have found the solution(s) to the problem.
Automated solution (for the hasty)
(in my case, which is also the default, that would be C:\MinGW\msys\1.0).
This will start the MinGW Shell, which will create the path
(your-MinGW-installation-directory)\msys\1.0\home\(your-username)
automatically and ssh should now work just fine.
Manual solution (basically create the path required by hand):
So, now the path
(your-MinGW-installation-directory)\msys\1.0\home\(your-username)
is available and ssh should work just fine.
Here is what you should get if everything went well:
Note
Since the MinGW Shell could create the path needed (without Windows UAC nagging about a thing), I guess this has nothing to do with persmissions. It is probably an omission of the MinGW installation.