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've read an enormous amount of articles but I seem to sidetrack more and more the more I try.

I'm trying to serve mercurial repos through HTTP. I'm using it together with redmine.

I've installed mercurial-server. I've set up a repo that I can't connect to from the outside. When I try to browse to that address I can see the index.html I put in the directory but when I use TortoiseHg and browse to the same address I get a 404. Am I supposed to point to a specific file? I've only tried pointing to the directory like so "".

Right now I'm only trying to pull the repo but I'd like to be able to push through HTTP temporarily if that is possible.

How will I set up user push access (through HTTPS) to the repo? Do the users have to exist on the linux machine? This is where the articles and tutorials confuse me as some mention "mercurial users" and others create own users on the machine serving the repo. I'd like to use the simplest scenario possible..

Please be as detailed as possible.. I'll greatly appreciate any help on the subject!

share|improve this question
up vote 2 down vote accepted

in the following working example you need a valid authentification to pull (see Require valid-user) and a valid authentication with a user of the group private to push (see Limit directive).

<Directory /var/www/sources.XXXXXXXXx/www/private/>
RewriteEngine on
        RewriteBase /private
        RewriteRule ^$ hgwebdiri.cgi  [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule (.*) hgwebdir.cgi/$1  [QSA,L]
        Options FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
        DirectoryIndex hgwebdir.cgi
        AllowOverride None
#       Order allow,deny
#       Allow from all
        AuthUserFile /etc/mercurial/hgweb.htpasswd
        AuthGroupFile /etc/mercurial/hgweb.htgroup
        AuthName "XXXXXXXXXXXXXx private sources"
        AuthType Basic
        Require valid-user
    <Limit POST PUT>
                Require group private
share|improve this answer

Don't forget to put 'allow_push' in either the global hgrc or the hosted repo's hgrc file.

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.