Welcome to Blogs @ Andrew Qu
Blog Index
All blogs
Search results

Setting up Hg Mercurial Simple Server


Shows how to install Hg Mercurial source control tool. Set it up to serve a single repository. The repository can then be accessed remotely.

Installing HG Mercurial

Install Tortoise Hg. from http://bitbucket.org/tortoisehg/thg/downloads/tortoisehg-2.4.1-hg-2.2.2-x64.msi. This is a Mercurial Source Control Tool with UI.

Verify installation by typing command >hg -h

Creating the Repository and Setting up the Server
  • In Windows explorer, go to the folder where you want to create the new repository.
  • Right click the mouse and in the context menu, select "TortoiseHg" -> "Create repository here"
  • In the dialog, type the repository folder name, eg. "C:\temp\repos1". Clock [OK]
  • Folder "repos1" should be created and in it there is a sub folder ".hg".
  • Create a text file "hgrc" (full path: C:\temp\repos1\.hg\hgrc). See below for full contents.
  • Start a DOS command and goto the new folder("repos1")
  • Type command >hg serve
    Default to port: 8000
  • You may specify a different port in the above command. For example, hg serve -p 8001
  • To verify you can access the repository, start a browser window, and type: http://localhost:8000/ You should see the emppty repository
  • That's all needed on the server.
Contents of "hgrc" file:
push_ssl = false
allow_push = *

Remotely Access the Repository
  • To access the repository on the same machine, simple type url: http://localhost:8000 whenever reference to the repository is required in Mercurial
  • To access from a remote machine on LAN, use "http://ComputerName:8000" or use lan address, eg "" (use DOS>ipconfig to find out LAN address)
  • To access from internet, you need to find out your internet router's IP address and also setup your router to forward port 8000 to your computer that hosts the repository. This is called "port forwarding". Google for more information.
Ads from Google
Dr Li Anchor Profi
Engineering anchorage plate design system
©Andrew Qu, 2014. All rights reserved. Code snippets may be used "AS IS" without any kind of warranty. DIY tips may be followed at your own risk.