---
title: "Git in Postgres"
url: https://daily.dev/posts/git-in-postgres-ba7yln5mf
source_url: https://nesbitt.io/2026/02/26/git-in-postgres.html
type: article
source: "Lobsters"
published: 2026-02-26T15:13:25.353Z
updated: 2026-07-30T02:12:49.225Z
tags: ["forgejo", "git", "postgresql"]
reading_time: 8
upvotes: 80
comments: 3
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Git in Postgres

**[Lobsters](https://daily.dev/sources/lobsters)** · 8 min read · 80 upvotes · 3 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nesbitt.io/2026/02/26/git-in-postgres.html>

## Community discussion

Top comments from developers on daily.dev.

**@andrewvaz** · 1 upvotes

> I always wondered if it would be faster to use a database such as Postgres as the back-end repository instead of the filesystem. Interesting to know about the pros and cons.

**@matj** · 0 upvotes

> yo gitlab does it, doesn't it ?

**@khauma** · 0 upvotes

> Interesting read

## Similar posts on daily.dev

- [pgit: What If Your Git History Was a SQL Database?](https://daily.dev/posts/pgit-what-if-your-git-history-was-a-sql-database--k2mbbtlm1) · Hacker News · 44 upvotes · 0 comments

---

Tags: [#forgejo](https://daily.dev/tags/forgejo), [#git](https://daily.dev/tags/git), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/git-in-postgres-ba7yln5mf)
