This guide assumes that you are familiar with got and remote repos which are located at /var/www/got/public/.

This guide also assumes that you have properly configured nsd with git as a subdomain.

NOTE: Replace all the instances of with your domain.


stagit is a simple static page generator for git. It generates static HTML pages for a git repository.


  1. It is written in C (with support for pledge and unveil).
  2. The code base is very simple and is about 1.5K LOC.
  3. Work very well with text-based browsers such as lynx and w3m.
  4. No CGI or dynamic code is required.
  5. No configuration required.
  6. Atom feed of the commit and tags/refs.


  1. Depends on libgit2.
  2. Not suitable for large repo with many files, commits(2000+), or branches.
  3. Does not support features like:
    1. Snapshot tarballs per commit.
    2. File tree per commit.
    3. History log of branches diverged from HEAD.
    4. Stats (git shortlog -s).
  4. This is by design, just use git locally.


Install the dependency:

$ doas pkg_add libgit2

Get the latest release of stagit from here. At the time of writing, it was 1.2.

$ ftp
$ ftp
$ sha256 -C stagit-1.2.tar.gz.sha256  stagit-1.2.tar.gz
(SHA256) stagit-1.2.tar.gz: OK

Extract, compile and install:

$ tar xvzf stagit-1.2.tar.gz
$ cd stagit-1.2
$ make
$ doas make install

If you get any error like this:

stagit.c:1239:19: error: use of undeclared identifier 'GIT_OPT_SET_OWNER_VALIDATION'
	git_libgit2_opts(GIT_OPT_SET_OWNER_VALIDATION, 0);

Edit Makefile and uncomment this line:


Now you should be able make and install without any error.

$ make
$ doas make install


Edit /etc/httpd.conf and add this section.

server "" {
	listen on * port 80
	root "/htdocs/"
	location "/.well-known/acme-challenge/*" {
		root "/acme"
		request strip 2

Restart httpd:

$ doas rcctl restart httpd

For ssl/tls upport, configure acme-client and relayd.

Generate static site

$ doas mkdir -p /var/www/htdocs/
$ doas cp favicon.png logo.png style.css /var/www/htdocs/
$ cd /var/www/htdocs/
$ doas touch
$ doas chmod +x

Edit and copy-paste the code below:



stagit-index "${reposdir}/"*/ > "${curdir}/index.html"

for dir in "${reposdir}/"*/; do
	r=$(basename "${dir}")
	d=$(basename "${dir}" ".git")
	printf "%s... " "${d}"

	mkdir -p "${curdir}/${d}"
	cd "${curdir}/${d}" || continue
	stagit -c ".cache" -u "$d/" "${reposdir}/${r}"

	ln -sf log.html index.html
	ln -sf ../style.css style.css
	ln -sf ../logo.png logo.png
	ln -sf ../favicon.png favicon.png

	echo "done"

Run to generate the html pages for all the repos:

$ doas ./

Now you can visit

NOTE: You have to run every time you make changes to the repos.

To change the logo, replace the default favicon.png and logo.png with your 32x32 logo and regenerate the html files.

Add Metadata

Add description, owner and url files to all the repos.

  • description - description of the repo.
  • owner - owner name of the repo.
  • url - clone URL of the repo, for example: git://

See Also:

Regenerate on git push or got send