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
- Public, unlisted and private repositories under
~user/name, with tree, log, blame, compare, history search and tar.gz or zip downloads of any ref - Branches, a branch switcher on every file view and a notice when a branch with new commits was pushed, linking straight to a new pull request
- Pull requests from a branch or a fork with inline review, range diffs between force pushes, and merge, squash or rebase without a working tree
- Organisations, collaborators, issues, labels, stars, forks, branch protection and per owner disk quotas enforced during the push
- Profiles with a pinned repository list, an activity graph and a README from your
~you/yourepository - SSH and PGP commit verification, TOTP, access tokens and Atom feeds for commits, issues and pull requests
- Site search over repositories and people with language facets
- Open, invite only or closed registration and an
/adminpage for accounts, invites, the front page and storage
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.