~gitpocket/gitpocket

1
ddd4238b49f3d3ec5dde978b5e097024677e99ee
mainfeed-discovery
gitpocket/README.md -rw-r--r--3.3 KiB ViewLogBlameView rawPermalink ddd4238b49 docs(install): add an install guide 12 days ago

View source

gitpocket

gitpocket is a self hosted git server in one static Go binary, serving repositories over SSH and HTTPS with a web interface rendered on the server. It idles at about 25 MB resident, so it fits comfortably on a 512 MB VPS next to the git processes it starts.

Quick start

git clone https://gitpocket.io/~gitpocket/gitpocket && cd gitpocket
useradd -r -m -d /srv/gitpocket -s /bin/sh git
printf 'GITPOCKET_HOST=git.example.org\nGITPOCKET_UID=%s\nGITPOCKET_GID=%s\n' $(id -u git) $(id -g git) > deploy/.env
docker compose -f deploy/compose.yaml up -d

The web interface is then on 127.0.0.1:3200 and wants a reverse proxy with TLS in front of it. Sign up, then make yourself an administrator with docker exec gitpocket gitpocket admin you. INSTALL.md covers the Docker and binary installs, nginx, SSH, mail, backups and upgrades in order.

Features

There is no wiki and no CI, and neither is planned.

Design

Every read of git data calls the plumbing with a thirty second timeout, so a large repository costs exactly what git says it costs and nothing is parsed out of packfiles in process. Ref tables, trees, summaries and languages are cached against the mtime of the refs, which means one stat after a push invalidates them and deleting the cache loses nothing.

Pull requests fetch the source into refs/pull/N/head of the target, and merges are merge-tree and commit-tree followed by an update-ref that names the old value, so a push racing the merge button makes the merge fail instead of being overwritten. SQLite comes from the pure Go modernc port, which is why a CGO_ENABLED=0 build needs nothing beside a system git.

Usage

git clone https://git.example.org/~you/repo
git clone git@git.example.org:~you/repo

SSH pushes need a key added under settings, and HTTPS pushes take an access token or your password. To contribute to something you do not own, fork it, push a branch to the fork and open a pull request from that branch.

Development

go test ./...

The tests drive the real handler through httptest, covering each registration mode, cross site posts, private repositories, moved repositories, every merge strategy and Markdown injection payloads.

Licence

MIT. KaTeX is MIT as well and Source Sans 3 is under the OFL, with both notices kept beside the files.