Thursday, January 03, 2013

GitHub/Bitbucket: Fixing The server's host key is not cached in the registry

If you are using putty as your ssh-agent, then to fix the annoying error you get when connecting to either GiHub or BitBucket for the first time :

"The server's host key is not cached in the registry"

Or you will get some output like this

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.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 [fingerprint here]
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
Store key in cache? (y/n)

You'll type "y" but you will get a failure response, because "git" won't be able to recognize your "y" since
that whole response is really coming from "putty" not from "git"

To fix this use "plink.exe" (comes with putty installation) to connect to either github or bitbucket

plink -agent

plink -agent

This will prompt you to save the host key in registry , and enter yes, then try your git command again, and it should be working.



Geoff Shannon said...

Awesome!! Thank you.