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: http://ucla.jamesyxu.com/?p=95)

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 http://example.com/hg, we want hg.example.com)

Authentication

If you seek clarification, look up at http://mercurial.selenic.com/wiki/PublishingRepositories

To configure security, add into the htaccess:

# Auth
AuthUserFile [Somewhere in your home]/hgweb.passwd
AuthGroupFile /dev/nullAuthName "hg Repos"
AuthType Basic
<Limit GET POST PUT>
Require valid-user
</limit>
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
[web]
contact =Name
description = Desc
push_ssl = false
allow_push = user from htpasswd that shoud have push access, csv

[ui]
username = Name <email@example.com>
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 , .