34

When using SSH as the connection for IDEA's git integration, IDEA keeps asking to store the host's rsa signature in the host key database. Pressing Yes works, but does not store the key in a database, the next time the connection is used, IDEA comes with the same question. Pressing No makes the connection fail.

I can't seem to find any configuration for IDEA's SSH connectivity, nor does google supply any useful results... Any thoughts on how to get rid of the key store dialogue?

Using:

IntelliJ IDEA 10.5.1 with JDK 1.6.0_22 on Windows XP

MySysGit 1.7.6 with both its bin/ and mingw/bin folders in %PATH%

"git.exe" as the git executable in IDEA

"IDEA ssh" as the SSH Executable in IDEA

openssh-server 1:5.5p1-6 (Debian Squeeze) on the server side

akaIDIOT
  • 9,171
  • 3
  • 27
  • 30

8 Answers8

39

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.

Cameron Stone
  • 857
  • 1
  • 8
  • 10
20

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.

Željko Trogrlić
  • 2,765
  • 1
  • 16
  • 20
  • 2
    This actually still applies for 2016.2.3. I just set HOME to the same value like USERPROFILE and built-in SSH client started to use my `.ssh` directory in that directory. – virgo47 Sep 08 '16 at 12:00
  • Another solution I found was: running IntelliJ as an administrator. Why would that also work? – Gerard Aug 03 '17 at 09:24
11

It seems Windows does not let IDEA change your personal settings as easily as one would expect. Making sure the host signature can be saved fixes the issue. To let IDEA do this, run IDEA as Administrator on Vista/Win7 or unset the "Protect my computer from unauthorized program activity" in XP's Run As dialog just once. After making an SSH connection and saving the signature this fixes the annoying dialog. After saving the signature, IDEA accepts the host even when run as a mortal user.

akaIDIOT
  • 9,171
  • 3
  • 27
  • 30
  • 2
    Any other idea ? I have the same problem described in this question, on IntelliJ IDEA Community Edition 13 on Windows 7 (up-to-date), and even started with administrator privilegies, i still have this - in the end - quite annoying pop up ("Confirm SSH Server Key" > "Do you want to add this host to known hosts database"). – SRG Jan 03 '14 at 20:56
2

I also have mSysGit and I have put "C:\Program Files (x86)\Git\bin" on the PATH.

There are at least two problems when using IntelliJ together with mSysGit and the ssh protocol with private/public keys :

IntelliJ does not know how to bring up the message about "The authenticity of host ... can't be established" so yes it helps to run the git command once by hand to get the .ssh/known_hosts file updated.

mSysGit when it is started directly outside of the "Git Bash" does not "know" where your home directory is and uses as .ssh folder "C:\Program Files\Git\.ssh".

I am wondering whether setting a HOME environment variable pointing to one's Windows home directory would help. Adding to the confusion, different tools have a different notion of where your home directory lives.

  • Cygwin thinks my home directory is under C:\Users\myself\AppData\Roaming.
  • Java apps think my home directory is under C:\Users\myself
  • my network home drive is H:\ on the corporate network and some tools think my real home is H:\
antoine
  • 287
  • 2
  • 9
1

Have you tried command line ssh to the server, and then accepting the host key? That should store it, as it won't go through some Java/JNI/Windows contortions.

Art Taylor
  • 1,188
  • 10
  • 19
  • That thought occured to me as well. Sadly, it didn't work like that; IDEA didn't look for the `known_hosts` like that. I did however fix the issue (I'll answer that myself now :P). – akaIDIOT Jul 20 '11 at 11:51
0

Easy solution,
In the IDE
Tools-->Deployment-->options Scroll down, SFTP Advanced Options (IDE level settings)

Change add new host key to known_known hosts to always

Change deployment settings

Mohsin Younas
  • 324
  • 4
  • 12
0

I'm not 100% sure what your problem is related to, but jetbrains has a page in their documentation about setting up ssh keys for git: using-git-integration.html

I'm running idea on a mac and have my ssh keys in the standard unix ~/.ssh and I never get any questions about key stores. On windows you probably should put your ssh keys under C:\Documents and settings\username.ssh

Also have a look at the version control tab in idea for more specific messages when troubleshooting vcs problems.

Tommy
  • 493
  • 2
  • 5
  • 16
  • 1
    The problem is not related to ssh keys to login, I use a simple password for that, which is fine for now. The problem is the rsa signature the server sends to be used by the client to verify the connection is made to the right server. – akaIDIOT Jul 19 '11 at 12:33
-3

Open Terminal and run below given command SSH key issue will be resolved.

git config --global http.sslVerify false
atiquratik
  • 1,296
  • 3
  • 27
  • 34
Jimy Ten
  • 57
  • 1
  • 3
  • This has a single downvote and no comments, so I feel the need to comment here. This is _crazy_ dangerous. Don't do this. – mirichan Feb 16 '19 at 01:19