Mercurial and self-signed server certificates
2012-10-13So mercurial aborts when you want to interact with a repository that uses a self-signed certificate, as is the case for my own little mercurial repo exposed over https.
NOTE: this is obviously insecure and you must verify the ssl cert’s fingerprint is correct. If you roll your own server, log into the server and get the fingerprint from the cert file itself, not over https since there could be a man in the middle.
Alright so you need to get a hold of the cert and extract its fingerprint. Over https it works like that:
|
|
And to get the fingerprint from your cert file directly on the server, do this:
|
|
So now you have the fingerprint you need to tell mercurial to accept said self-signed certificate for a given hostname, which you do in ~/.hgrc
|
|
And that’s it!