hg serve as Windows service

Or you could use the SCM-Manager


Using a web server such as apache/lighttpd/iis gives a lot of features such as authentication or HTTPS support. But 'hg serve' is a simple and fast solution. Furthermore, 'hg serve' can serve multiple repositories. But hg serve cannot itself be run as a Windows service because it cannot respond to the Windows control commands. So using HgService is a good solution to make 'hg serve' a real Windows service.

Here is an example of my configuration. I followed following steps:

  • Install TortoiseHG
  • Install HgService
  • Create "C:\Repositories" folder and put needed repos into it.
  • Create "C:\Repositories\hgweb.config" with following contents:
[paths]
/ = C:\Repositories\*

[web]
style = monoblue
  • Modify HgService.exe.config in C:\Program Files\Mercurial\HgService
<add key="CommandLine" value="hg.exe"/>
<add key="CommandLineArguments" value="serve --prefix=/hg --address 0.0.0.0 --port 80 --web-conf c:\Repositories\hgweb.config -A access.log -E error.log" />
  • Start the service

Hope this sequence of action will be helpful to you also.