7

I have a remote repo which I want to clone. I've set up pageant.exe and added private key. Also added GIT_SSH variable which points to plink.exe. And after clone command I get such output

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
...
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

When typing y or n nothing happens, console just hangs and I have to terminate the command with Ctrl+C

Why this happens and how to fix this?

maks
  • 5,911
  • 17
  • 79
  • 123

1 Answers1

2

After several hours of investigation I finally found a solution. The putty has to know smth about the host you're connecting to, namely host must be known_host to putty. Putty stores information about know_hosts under HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys registry key. To force putty to add information about that host to registry key we can by accessing via putty.exe using your private key. On first access putty will ask you to add that host to known_hosts. After that git clone command finishes successfully.

Maybe this will be helpful for somebody, because it's not obvious from the first glance

maks
  • 5,911
  • 17
  • 79
  • 123
  • 2
    the "real" issue is that git (i believe it's "git for windows") doesn't pass the input to whatever process asks "Store key in cache? (y/n)" (it's probably one of ssh programs - putty or plink). – andrybak Nov 18 '15 at 13:36
  • 4
    Damn incomplete accepted answer omg. @andrybak is very right. Just call ```"%GIT_SSH%" thehost.com``` and you'll have the option to select ```y```. You'll experience what @andrybak explains – Cyril CHAPON Apr 05 '16 at 13:44
  • for me it was plink causing the issue so I switched it to use openSSH and its working now – Eman Sep 28 '16 at 00:41
  • i also faced ts problem. i had `GIT_SSH` environment path set to location for `plink.exe`. by entering into the command prompt what @CyrilCHAPON wrote fixed the issue (`"%GIT_SSH%" url.to.ssh.repo.com`) – Eric Jul 28 '22 at 08:34