An exploration of storing git repositories inside PostgreSQL instead of the filesystem. The author built gitgres, a ~2,000-line C library implementing libgit2's object and ref database backends against Postgres via libpq. The git data model maps to just two tables (objects and refs), enabling SQL queries that join commit history with application data like issue trackers. The post argues this approach could simplify self-hosted forge deployments (targeting Forgejo/Gitea) by eliminating the split between a Postgres-backed web app and filesystem-based bare repos, enabling unified backups with pg_dump, row-level security for multi-tenancy, and NOTIFY-based push events. Storage overhead from lack of delta compression is acknowledged as a real trade-off, but the author argues operational simplicity outweighs it for small instances.
3 Comments
Sort: