Posted by: Josh | April 27, 2010

Set Up Mercurial 1.5.1 on a Shared Host, Simplified

This procedure significantly removes the complexity of the set up detailed in a previous post.

  1. Download and extract this archive.
  2. Replace the ~/python/mercurial folder with an alternate build if necessary (this one is for x86_64/python2.4).
  3. Upload to your web host.
    * Note: The Mercurial CGI is designed to be run in a top-level domain or sub-domain.
  4. Ensure the following settings:
    ~/cgi-bin/hgwebdir.cgi has permissions 755 (rwxr-xr-x)
    ~/cgi-bin/hgweb.config has file paths changed relative to your server
    ~/.htaccess has AuthFile paths changed relative to your server
  5. Check to see if the site works.

To create a new repository, copy the example directory in the /cgi-bin folder to the same directory, fix it’s hgrc file in a text editor, and register this new project in hgweb.config. Configuration files:

  • hgweb.config – repository directory config
  • hgrc – per-project config

And that’s all. That was easy!


  1. […] Mercurial through this simple setup guide and ensure it is […]

  2. It is awesome that you are enabling the use of hg repos on shared host. I was wondering; using the binaries you provided, would it be possible to run mercurial locally through ssh on my host? Basically, I cannot install mercurial (jailshell without gcc), but I’d still like to clone a repository to my shared host while logged in to ssh. Any ideas?

  3. The minimum your shared host will need is an installation of Python (I believe you can type “py –version” at the shell prompt in most cases to check). Then, if you SFTP the appropriate binaries to your shared host, Mercurial should be executable as “./hg”, “py hg” or something similar, which will then be invoked over SSH by a remote client. I haven’t tried this, but I remember skimming a bunch of support docs on the Mercurial home page regarding it (I’m on a very slow satellite connection right now, or I’d help you search). Let me know if you need any help with the binaries. I’m curious to see how this turns out!

  4. Unfortunately that doesn’t work. Running “python” does nothing at all, even passing in args. Looking at the script in nano, I don’t see how actually processes args…

  5. Worked for me! 🙂 Thanks!

  6. I know it’s very old, but I’m getting

    ImportError: python/mercurial/ failed to map segment from shared object: Operation not permitted

    What do I do?

  7. Me apasiona la forma en que haas planteado el contenido.
    Este web blog va rapidamente a preferidos! Cordialmente agradecido por lla asesoria!

  8. No esta mal, aunque sin duda es mas conviente que postees
    sobre el contenido con todavia mas documentacion. Un saludo

  9. 艾可力魔力净

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: