http://www.selenic.com/mercurial/wiki/index.cgi/HgWebDirStepByStep seems to be the tutorial I had used. Here are the steps I seem to have followed:
Note: I did this quite some time ago, Mercurial might have gotten updated since and some of the steps might have changed. Mercurial is not particularly known for preserving backward compatibility.
Assumptions:- You want to set up Mercurial on its own sub-domain, say hg.oktave.in.
- You want to be able to expose multiple repositories through this install.
- You want to provide HTTP based access to all the repositories and use HTTP-based authentication to limit access.
Steps:From the root of the webapp:
$ cat >>.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^hg.oktave.in [NC]
RewriteCond %{HTTP_HOST} !^/hg/
RewriteRule ^(.*) /hg/$1 [L,PT]
^D
$ mkdir hg
$ cd hg
$ wget http://www.selenic.com/repo/hg-stable/raw-file/tip/hgwebdir.cgi
$ cat >hgweb.config # /path/to/hg is the filesystem path of the current directory
[collections]
/path/to/hg = /path/to/hg
^D
$ cat >.htaccess
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
Require valid-user
Options +Indexes
Options +ExecCGI
# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
RewriteEngine On
RewriteBase /hg
RewriteRule ^$ hgwebdir.cgi [L]
RewriteCond %{REQUEST_FILENAME} !hgwebdir.cgi
RewriteRule (.*) hgwebdir.cgi/$1 [QSA,L]
^D
$ cat >hgrc.sample
[web]
name = XXX
description = XXX
contact = FirstName LastName <email@address>
allow_push = *
push_ssl = false
allow_archive = bz2 gz zip
style = gitweb
^D
Adding a new project:
$ mkdir project
$ cd project
$ hg init
$ cp ../hgrc.sample .hg/hgrc
$ vi .hg/hgrc # set the name and description
Et voila!
Take a look at
http://hg.oktave.in/For authentication, use htpasswd to add some usernames/passwords to /path/to/.htpasswd