Mercurial (hg) with active directory

Can I setup Mercurial to authenticate users on Active Directory? In my case, hg can run on Windows, Linux or FreeBSD, but I need to use AD users.

Note: if it is possible, then please point me to a tutorial.


Well, I started with this tutorial.

After I've finished that I made the following additional changes on the server (Windows 2008):

  • Configured IIS to use SSL;
  • Disabled anonymous authentication for the site;
  • Enabled Basic and Windows authentication for the site;
  • Configured NTFS permissions on the repository folder.

Also need to add the following lines to your repository's .hg\hgrc file:

On the client-side I had to explicitly specify username and password.

[web]
allow_push = *

If you're looking for some integrated system that can work on windows, unix, and authenticate to AD/LDAP try out RhodeCode http://rhodecode.com It's kind of local instance of bitbucket/github that serves repositories. It comes with permission system and easy user management, code review etc.


I wrote a 4 part blog post a couple of months back that allows you to use Active Directory/IIS to host Mercurial's web server. It works a treat:

http://www.endswithsaurus.com/2010/05/setting-up-and-configuring-mercurial-in.html

It walks you through:

  • Set up of Mercurial within IIS
  • Configuring the ISAPI extensions for Python
  • ISAPI rewrite to hide ugly URLs
  • Configuration of security privileges using Active Directory
  • Customization of the web UI