Logging into a Mercurial repository on Sourceforge with an SSH private key

I was just about to post the following to stackexchange.com:

I have got a mercurial repository on sourceforge.net, generated an ssh key with PuttyGen and uploaded it to Shell Services Configuration as described in the relevant site documentation. I then started Pageant and entered my passphrase.

Now, I can connect to shell.sourceforge.net without entering a password and create a session there that works fine. So, the key has been generated correctly and uploading the public key also worked fine.

As I understand it, I should now also be able to use the command

hg pull

on a sourceforge repository without the need to enter my password. I therefore added the following line to my mercurial.ini file, in the ui section:

ssh="C:\Program Files (x86)\PuTTY\plink.exe" -ssh -agent -v -i "D:\path\to\my\private_key.ppk"

Unfortunately any hg command that requires a connection to the sourceforge repository times out. If I remove that line again, everything works fine, but I have to enter my password.

hg --debug pull

emits the following lines:

And then I tried it again to get the error messages for posting into the question. Guess what? This time it worked. I swear, I didn’t do anything different than before and I haven’t changed anything. All previous attempts failed with the error “Server refused our key”. So I guess sourceforge changed something. Maybe it was a case of synchronizing the public key to all servers taking forever (several days) or maybe they came around to reading my support request and doing something about it.

Don’t you hate it when things start working without you knowing what caused it to fail in the first place? I certainly do!