gitgres
Store Git objects and refs inside PostgreSQL
TLDR
SYNOPSIS
gitgres-backend command connectionstring reponame [path]
DESCRIPTION
gitgres stores Git objects and refs as rows in PostgreSQL tables. A small libgit2-based backend (gitgres-backend) translates standard Git protocol operations such as push and clone into SQL, so existing Git clients work against a database instead of a filesystem.The project's stated goal is to let Git forges (e.g. Forgejo, Gitea) drop their filesystem storage entirely and rely on the database for repositories, objects, refs, and reflog. The schema includes tables for repositories, objects, refs, and reflog, with helpers for hashing, the object store, and tree and commit parsing.
COMMANDS
init conn repo
Create the database tables (if needed) and register a new repository named repo.push conn repo path
Push the on-disk Git repository at path into the database under name repo.clone conn repo path
Materialize the database-backed repository repo to a normal on-disk Git repository at path.ls-refs conn repo
Print the refs currently stored in the database for repo.
REQUIREMENTS
PostgreSQL with the pgcrypto extension is required. The backend links against libgit2, libpq, and OpenSSL. The shell-based importer (./import/gitgres-import.sh) needs only a working psql client and a Git checkout.
CAVEATS
The project is research-grade: storing repositories in PostgreSQL incurs different I/O and locking patterns than a filesystem. Performance, vacuuming, and replication characteristics differ from traditional Git hosting and should be benchmarked before production use. Backups must include the database dump, not the working tree.
HISTORY
gitgres was created by Andrew Nesbitt to explore eliminating filesystem dependencies for Git forges, motivated by the operational simplification of having a single backing store (PostgreSQL) for both metadata and Git data.
