hg.sr.ht is the hg repository hosting service for the sr.ht network.


hg.sr.ht is a standard sr.ht web service and can be installed through the standard procedure. However, there are several additional steps required.

  • hg.sr.ht: the web service
  • hgsrht-periodic: various maintenance tasks. Recommended configuration is */20 * * * * hgsrht-periodic
  • hgsrht-clonebundles: optional cronjob to generate clone bundles. Recommended to run daily, e.g. 0 * * * * hgsrht-clonebundles

Clone bundles are computationally expensive to create, and use up more disk space, but may dramatically speed up clone operations on large repositories.

Repository storage

You will need to set up a directory for repositories to be stored in - we suggest /var/lib/hg/. Also configure a hg user and assign ownership over /var/lib/hg/ to this user. The hg.sr.ht package will automatically prepare these for you. If you do not use the package, you must create the user yourself and ensure that the hg.sr.ht web application runs as this user.

SSH dispatch

At the moment, hg.sr.ht uses git.sr.ht's SSH dispatcher, which you need to setup as the system-wide SSH authorization hook. See the git.sr.ht documentation for more information.

Once this is done, you need to make the hg.sr.ht authorization hook be part of the SSH dispatching, via the hgsrht-keys and hgsrht-shell scripts. See the [dispatch] section of you hg.sr.ht configuration for details on how this works.

Authorization logs are written to hg-srht-shell.

HTTP(s) Cloning

hg.sr.ht does not do this for you - you need to wire it up in nginx. Here's an example config:

location = /authorize {
		proxy_pass_request_body off;
		proxy_set_header Content-Length "";
		proxy_set_header X-Original-URI $request_uri;

location ~ ^/[~^][a-z0-9_]+/[a-zA-Z0-9_.-]+/\.hg.*$ {
		auth_request /authorize;
		root /var/lib/mercurial;

About this wiki

commit ae651dd0eab9b70a2877249cd3e9f536693457f5
Author: наб <nabijaczleweli@nabijaczleweli.xyz>
Date:   2020-07-14T16:46:00+02:00

Update alpine mirror link from 3.11 to 3.12

Individual packages are outdated on the 3.11 branch
Clone this wiki
https://git.sr.ht/~sircmpwn/sr.ht-docs (read-only)
git@git.sr.ht:~sircmpwn/sr.ht-docs (read/write)