Repositories / gitweb2.git

gitweb2.git

Clone (read-only): git clone http://git.guha-anderson.com/git/gitweb2.git

Branch
.gitignoreblob
dune-projectblob
gitweb2.opamblob
Makefileblob
README.mdblob
servicetree
srctree
testtree

README.md

# gitweb2 An OCaml, read-only web viewer for local Git repositories. The app uses `cohttp-eio` for HTTP and the local `ocaml-git` OCaml package for repository reads. ## Requirements - OCaml 5.4 or newer - opam - dune - system `git` - the local `ocaml-git` package installed or pinned ## Build From this repository, after installing or pinning `ocaml-git`: ```sh opam install . --deps-only --with-test dune build ``` ## Run ```sh dune exec gitweb2 -- ~/repos ``` Options: ```sh dune exec gitweb2 -- ~/repos --host 127.0.0.1 --port 8080 --pygments "uv run --with pygments pygmentize" ``` Use `--public-url` when the public address differs from the bind address (e.g. behind a port-forward or reverse proxy). It sets the base used in the displayed clone URL and overrides the request `Host` header: ```sh dune exec gitweb2 -- ~/repos --host 0.0.0.0 --port 8002 --public-url https://git.example.com ``` Press `Ctrl+C` to stop the server. ## systemd (homebox) This repo carries a **user** unit for the host **homebox** (paths and ports are fixed in the unit). See [service/README.md](service/README.md). The server scans nested directories for Git repositories and renders repository, branch, file, directory, and commit history pages. Nested repository paths and branch names that contain slashes are percent-encoded in URLs: ```text /repo/homebox%2Focaml-git/main/README.md /repo/homebox%2Focaml-git/main/-/commits ``` ## URLs For a repository discovered with key `<repo>`, the server exposes two URLs: | Purpose | URL | | ------------------------------ | ----------------------------------------- | | HTML viewer | `http://<host>:<port>/repo/<repo>` | | Read-only clone (smart HTTP) | `http://<host>:<port>/git/<repo>` | The clone URL is also displayed at the top of every repository page. Cloning is implemented by spawning `git http-backend` as CGI, so the system `git` binary must be on `PATH`. Push is not supported. ```sh git clone http://<host>:<port>/git/<repo> ``` ## Hooks: do you need `post-update`? No. Smart HTTP via `git http-backend` reads refs and packs from the live repository on every request, so the `info/refs` and `objects/info/packs` files are not consulted and there is nothing to refresh after a push. The traditional `post-update` hook is only needed for **dumb** HTTP, where the client fetches static files out of `.git/`. If you ever do want to expose a bare repo over dumb HTTP (or another tool expects up-to-date `info/` files), enable the sample hook git ships: ```sh cd /path/to/repo.git mv hooks/post-update.sample hooks/post-update chmod +x hooks/post-update git update-server-info # one-off, to seed the files ``` That hook just runs `git update-server-info` after each push. With gitweb2's smart HTTP route this is unnecessary.