Saturday, August 13, 2011

Mercurial seems to hang in SourceForge connection because of host key change

Had a problem where mercurial seemed to hang forever in a SourceForge transaction.
It was run from within Eclipse via MercurialEclipse, and there was no indication as to
what's happening nor any way to stop it other than to kill Eclipse.

This was under Windows with hg calling putty, which in turn was configured to use an ssh key pair registered with SourceForge that had worked OK some time ago.

When executing hg from the command line, it would also hang, but I could stop it with Control-C, and then it would show the following message:

hg clone ssh://name@....hg.sourceforge.net/hgroot/....
interrupted!
remote: The server's host key is not cached in the registry. You
remote: have no guarantee that the server is the computer you
remote: think it is.
remote: The server's rsa2 key fingerprint is:
remote: ssh-rsa 2048 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d
remote: If you trust this host, enter "y" to add the key to
remote: PuTTY's cache and carry on connecting.
remote: If you want to carry on connecting just once, without
remote: adding the key to the cache, enter "n".
remote: If you do not trust this host, press Return to abandon the
remote: connection.
remote: Store key in cache? (y/n) ^C

Again this was under Windows. On a real operating system the host key change prompt might have appeared before the Ctrl-C and thus be more obvious.

Anyway, the fix:

Run
putty -i path\to\the\key.ppk
once which will show the same host key change prompt and this time you can accept it.

From then on, hg works OK again.

No comments:

Post a Comment