Mercurial pushes and the authorization failure of doom!
Posted on Friday, January 27, 2012 at 9:00:00 PMDevelopment | sourcecontrol mercurial
Ever get the notorious “abort: authorization failed” message from a Mercurial “push” command??
You are not alone!
It seems the way to fix this is to always ensure that the Bitbucket username is specified within the “remote repository” URL!
i.e. the remote repository URL should be something like “https://firstname.lastname@example.org/craigtp/fizzbuzz” and NOT “https://bitbucket.org/craigtp/fizzbuzz” – See the screenshot to the right. In this case, my username is “craigtp”, obviously, replace that with your own username for your own repository/Bitbucket account.
Bizarrely, this is still required to get around the “authorization failed” issue even though TortoiseHg will prompt you at runtime for both your bitbucket username and password (if the username is not specified in the URL). Once you’ve specified your username in the URL, you’re no longer prompted for it, only the password, however the “abort: authorization failed” issue will go away!
I’ve done further digging since posting this article, and unfortunately, I’m not convinced that this is the exact answer to the authorization problem. Doing the above certainly fixed my specific problem at the time I had it, in the very specific circumstances of my environment (which including accessing BitBucket via a rather fussy proxy server) however I’ve since been able to happily make Mercurial pushes to BitBucket without having to specify the username in the remote repo URL in different environments. My research on this matter continues!