How to store SSH host key in IntelliJ IDEA

I had same issue with IDEA 13 and 14. By default, IDEA will try to create/access .ssh/known_hosts file in %HOME% directory.

However, %HOME% was not defined on my system (Windows 7 Enterprise x64). IDEA wouldn't store key; rather, it would ask for it for every operation.

When I defined %HOME% (%HOME% = %HOMEDRIVE% in my case), everything worked as advertised.

This is a confirmed bug in IDEA; it should search:

  • %HOME%
  • %HOMEDRIVE%
  • %HOMEPATH%
  • %USERPROFILE%

Check also this issue.


I just had the same problem with IDEA 13 on Win7, and it was solved by switching to "Native" SSH executable in the Git Settings page. I did that while running Intellij as administrator as suggested by the accepted answer, but the accepted answer didn't fix the problem until I changed the SSH executable.