How do you set up a mercurial server in a Debian droplet?

March 24, 2016 1.3k views
Apache Git DigitalOcean Networking VPN Python Debian

I am trying to set up the version control tool, Mercurial on my Debian8 droplet on an Apache2 server.
Mercurial seems to be installed on my server however when i try to access the repository startpage of the Mercurial server, the following python code from the hgweb.cgi file is being displayed instead.

http://128.199.249.221/hg

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)
1 comment
  • not sure if it is going to help, but i suspect that it is a permissions issue with the "hgweb.cgi" file - perhaps it needs to be set to execute or that it is not configured properly. I haven't setup mercurial so it is more or less a stab in the dark.

    you may wish to look into your apache2 error log files and see if there might be anything there - probably /var/log/apache2/ or something similar on Ubuntu.

1 Answer

This question was answered by @SphericalCow:

not sure if it is going to help, but i suspect that it is a permissions issue with the "hgweb.cgi" file - perhaps it needs to be set to execute or that it is not configured properly. I haven't setup mercurial so it is more or less a stab in the dark.

you may wish to look into your apache2 error log files and see if there might be anything there - probably /var/log/apache2/ or something similar on Ubuntu.

View the original comment

Have another answer? Share your knowledge.