Skip to content

Setting up Mercurial with Dreamhost – Part 2

Part 2 details how to configure security, setting up a repo, and running off sub domains (Part 1 is here:

So step one left us with a running Mercurial with the web interface. Now we need to do a few more things:

  • Configure security
  • Setting up repositories
  • Running off sub domains (so instead of, we want


If you seek clarification, look up at

To configure security, add into the htaccess:

# Auth
AuthUserFile [Somewhere in your home]/hgweb.passwd
AuthGroupFile /dev/nullAuthName "hg Repos"
AuthType Basic
Require valid-user
To create the passwd file:
htpasswd -c -m [PATH]/hgweb.passwd

Now if we visit the HG address, it should ask for authentication

Setting up Repo

So now we setup a repo. Goto where the hg is hosted:
cd repos
hg init [repo name]
vi [repo name]/.hg/hgrc
contact =Name
description = Desc
push_ssl = false
allow_push = user from htpasswd that shoud have push access, csv

username = Name <>
charset = utf-8

Running on a subdomain

Recall to set up for a /sub directory, all we need to do is a symlink.

For subdomain its slightly more complex:

Copy the hg directory to the subdomain

vi .htaccess
change RewriteBase /hg to /
vi hgweb.cgi
after import sys line, add:
import os
os.environ["SCRIPT_NAME"] = ""

All set, we are now ready to go with hg 😀


To delete a repository, just remove the directory on the server

Posted in Technology. Tagged with , .