Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been searching, but I couldn't find a tutorial with a step by step guide to creating authentication for Mercurial. From what I have found, a lot of people are pointing to this resource, but it doesn't seem to show what I am trying to achieve:

Can someone please show me where I can find a guide to setup authentication with Mercurial? HTTPS, or public key system, they both work!

Thank you

share|improve this question
authentication heavy depends from access protocol. http OR ssh, you have to select – Lazy Badger Feb 26 '12 at 6:21
Lenny is End of Life. – Zoredache Feb 26 '12 at 8:23
@Zoredache Should I be upgrading to Squeeze? – Doug Feb 26 '12 at 11:58
up vote 3 down vote accepted

The page you've found has the information for HTTP, it's in section 6.3: Adding authentication. You need to configure Apache to do Basic authentication for requests to hgwebdir.cgi, that's all.

Just remember that Mercurial does not authenticate HTTP users. It's the job of the front-end webserver, such as Apache. That has the advantage that you can re-use your existing infrastructure for authentication: if you've already got a setup where Apache uses LDAP for Active Directory authentication, then Mercurial will inherit that.

For SSH you can look in the Hg Book and the Shared SSH and Multiple Committers wiki pages. Here you must remember that access control boils down to normal file system permissions once the user has been logged into the server.

Finally, I wrote a guide about interacting with remote repositories that might contain a hint or two that you can use.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.