​wit / README.md
236 commits
29-11-2026
73 lines 4.4 kB

A lightweight, static Git web frontend written in Rust

Installation

Build with Rust's cargo (Rust 1.96 or newer), then install (PREFIX defaults to /usr/local):

make
sudo make install

This installs wit to ${PREFIX}/bin, its man page to ${PREFIX}/man/man1, and style.css, favicon.ico, fonts/, post-receive, README.md and LICENSE to ${PREFIX}/share/doc/wit. make uninstall removes them. DESTDIR and MANPREFIX work as usual.

At runtime wit needs libgit2 and git (for git archive).

Crate dependencies:

Usage:

wit [-O owner] [-u repo] -o outdir repo...

wit writes a static site for the listed repos into outdir: an index of the repos, and for each one a summary, tree and file pages and a commit log for every branch and tag, a page for every commit, and its branches, tags and releases. A repo is a bare repo or a working copy, named after its folder without .git.

Each repo can have a description and an owner file, in a bare repo's dir or a working copy's .git/. Two repos with the same name stop the run; a repo whose HEAD has no commits or is detached is skipped with a warning.

For example, to build a site for every repo in /srv/git:

wit -O alice -o /var/www/git /srv/git/*.git
cd /usr/local/share/doc/wit && cp -r style.css favicon.ico fonts /var/www/git/

See man wit for the details.

Stylesheet

wit doesn't write a stylesheet. Copy style.css, favicon.ico and the fonts/ dir (installed in ${PREFIX}/share/doc/wit) into the site dir (the one after -o), and copy them again after changing them or updating wit. Every page links style.css and favicon.ico at the site's top.

Rebuilding on every push

Copy contrib/post-receive into each bare repo's hooks/ dir, keep it executable, and set its paths: the site dir after -o, then every repo the site lists. git runs the hook inside the pushed repo, so -u . rebuilds only that repo, plus any repo that has no pages yet; the index is rewritten from all of them. Run wit without -u to rebuild every repo, e.g. after updating wit or changing a description or owner. A rebuilt repo's old pages are deleted first.

Releases

Put a tag's files in the bare repo's releases/<tag>/ folder (in a working copy, .git/releases/<tag>/), next to description; git ignores it. Upload them over SSH, then push the tag, so the hook builds the release:

ssh user@server mkdir -p <repo>/releases/v1.2
scp foo-linux-x86_64 foo-linux-aarch64 user@server:<repo>/releases/v1.2/
git push origin v1.2

The repo gets a releases tab and a "latest release" row on its summary. The releases page shows the first line of each release's tag message as its title, beside the tag's name, the rest of the message as markdown, and its files as download links, with their sizes and sha256 sums, followed by the tag's source code as .zip and .tar.gz.

wit hardlinks the files into the site, at <repo>/releases/<tag>/, so keep the repos and the site on one filesystem; otherwise it copies them on every rebuild. A hardlink has the upload's permissions, so the web server must be able to read the uploaded files. Serve the site over HTTPS only.

Credits

The icons are from Phosphor Icons, Copyright (c) 2023 Phosphor Icons, licensed under the MIT License (fonts/phosphor-icons-MIT.txt). The font is Recursive, Copyright 2019 The Recursive Project Authors, licensed under the SIL Open Font License 1.1 (fonts/OFL.txt). The math font is a subset of New Computer Modern Math, modified by math-core-fonts, licensed under the GUST Font License (fonts/GUST-FONT-LICENSE.txt, fonts/lppl.txt). The CSS fixes for math come from math-core, Copyright 2020 Hiromu Sugiura, MIT License (fonts/math-core-MIT.txt).

 1A lightweight, static Git web frontend written in Rust
 2
 3## Installation
 4
 5Build with Rust's cargo (Rust 1.96 or newer), then install (`PREFIX` defaults to `/usr/local`):
 6
 7```
 8make
 9sudo make install
10```
11
12This installs `wit` to `${PREFIX}/bin`, its man page to `${PREFIX}/man/man1`, and `style.css`, `favicon.ico`, `fonts/`, `post-receive`, `README.md` and `LICENSE` to `${PREFIX}/share/doc/wit`. `make uninstall` removes them. `DESTDIR` and `MANPREFIX` work as usual.
13
14At runtime wit needs libgit2 and git (for `git archive`).
15
16Crate dependencies:
17
18- git2
19- chrono
20- pulldown-cmark
21- anyhow
22- imagesize
23- sha2
24- math-core
25
26## Usage:
27
28```sh
29wit [-O owner] [-u repo] -o outdir repo...
30```
31
32wit writes a static site for the listed repos into `outdir`: an index of the repos, and for each one a summary, tree and file pages and a commit log for every branch and tag, a page for every commit, and its branches, tags and releases. A repo is a bare repo or a working copy, named after its folder without `.git`.
33
34- `-o outdir`: the site dir.
35- `-O owner`: the owner shown for repos whose `owner` file is missing or empty.
36- `-u repo`: rebuild only this repo, plus any listed repo that has no pages yet (see Rebuilding on every push).
37
38Each repo can have a `description` and an `owner` file, in a bare repo's dir or a working copy's `.git/`. Two repos with the same name stop the run; a repo whose HEAD has no commits or is detached is skipped with a warning.
39
40For example, to build a site for every repo in `/srv/git`:
41
42```sh
43wit -O alice -o /var/www/git /srv/git/*.git
44cd /usr/local/share/doc/wit && cp -r style.css favicon.ico fonts /var/www/git/
45```
46
47See `man wit` for the details.
48
49### Stylesheet
50
51wit doesn't write a stylesheet. Copy `style.css`, `favicon.ico` and the `fonts/` dir (installed in `${PREFIX}/share/doc/wit`) into the site dir (the one after `-o`), and copy them again after changing them or updating wit. Every page links `style.css` and `favicon.ico` at the site's top.
52
53### Rebuilding on every push
54
55Copy `contrib/post-receive` into each bare repo's `hooks/` dir, keep it executable, and set its paths: the site dir after `-o`, then every repo the site lists. git runs the hook inside the pushed repo, so `-u .` rebuilds only that repo, plus any repo that has no pages yet; the index is rewritten from all of them. Run wit without `-u` to rebuild every repo, e.g. after updating wit or changing a description or owner. A rebuilt repo's old pages are deleted first.
56
57### Releases
58
59Put a tag's files in the bare repo's `releases/<tag>/` folder (in a working copy, `.git/releases/<tag>/`), next to `description`; git ignores it. Upload them over SSH, then push the tag, so the hook builds the release:
60
61```sh
62ssh user@server mkdir -p <repo>/releases/v1.2
63scp foo-linux-x86_64 foo-linux-aarch64 user@server:<repo>/releases/v1.2/
64git push origin v1.2
65```
66
67The repo gets a releases tab and a "latest release" row on its summary. The releases page shows the first line of each release's tag message as its title, beside the tag's name, the rest of the message as markdown, and its files as download links, with their sizes and sha256 sums, followed by the tag's source code as `.zip` and `.tar.gz`.
68
69wit hardlinks the files into the site, at `<repo>/releases/<tag>/`, so keep the repos and the site on one filesystem; otherwise it copies them on every rebuild. A hardlink has the upload's permissions, so the web server must be able to read the uploaded files. Serve the site over HTTPS only.
70
71## Credits
72
73The icons are from [Phosphor Icons](https://github.com/phosphor-icons/core), Copyright (c) 2023 Phosphor Icons, licensed under the [MIT License](https://github.com/phosphor-icons/core/blob/main/LICENSE) (`fonts/phosphor-icons-MIT.txt`). The font is [Recursive](https://github.com/arrowtype/recursive), Copyright 2019 The Recursive Project Authors, licensed under the SIL Open Font License 1.1 (`fonts/OFL.txt`). The math font is a subset of [New Computer Modern](https://git.gnu.org.ua/newcm.git/about/) Math, modified by [math-core-fonts](https://github.com/tmke8/math-core-fonts), licensed under the GUST Font License (`fonts/GUST-FONT-LICENSE.txt`, `fonts/lppl.txt`). The CSS fixes for math come from [math-core](https://github.com/tmke8/math-core), Copyright 2020 Hiromu Sugiura, [MIT License](https://github.com/tmke8/math-core/blob/main/LICENSE) (`fonts/math-core-MIT.txt`).