Git at Scale: How the Large Hosts Store Repositories, and Where It Breaks

By Edward Grundy, Bay Information Systems. Published . In Architecture & Deployment.

In the space of three months in 2026, Cursor and Netlify each described a git service built on Amazon S3, Anthropic reported that its monorepo had moved off git entirely, and GitHub published the design of a new storage layer for every repository it hosts. Git was over twenty years old, and these changes affected where data is kept.

Git’s internal model, set out in our git deep dive, is a store of immutable objects named by their hashes, plus a small set of mutable names. Its implementation adds an assumption that a repository is a directory on one machine, read and written through the local filesystem. That assumption fails in two places: A repository can become too busy for one machine to serve, which is the host’s problem, and it can become too large for one machine to hold or scan, which is the developer’s.

In this article we discuse the hosting issue, then the very large repositories, then the designs of 2026.

One repository, one filesystem

Git reads and writes ordinary files. A name is updated by writing a lock file beside it; every command expects the repository to sit on a disk it can open. The simplest way to serve repositories to a fleet of web and application servers is therefore a shared network filesystem. GitLab and Bitbucket started there.

GitLab mounted its repositories over NFS on every application server and background worker. After spending two years looking at alternatives (Ceph was one candidate), they created Gitaly in 2018. This is a service that runs git on the machine holding the disk and answers requests over RPC. NFS support was deprecated in GitLab 14.0 and removed in 15.6. Atlassian made the same move in Bitbucket Data Center 8.0 with Mesh, which replaced NFS with replicated storage nodes that run git locally. Its documentation names the cause: network filesystem latency is tolerable for a large operation such as streaming a pack, and severe for the small ones, reading a name or a single loose object, that git performs constantly.

The lesson both drew was to move git to the data, since git’s access pattern (many small reads of names and objects) is the worst case for a remote disk.

Replicating whole repositories

With git running beside its disk, the next problem is losing the disk. The answer through the 2010s was to keep several complete copies of each repository and coordinate writes between them.

GitHub replaced block-level disk replication (DRBD, which was sensitive to latency and forced replicas to sit close together) with DGit in 2016, soon renamed Spokes. Spokes keeps three copies of each repository on three servers and replicates at the level of git itself: a write is committed only when at least two replicas confirm it. GitLab built Gitaly Cluster, in which a proxy called Praefect routes traffic to replicated Gitaly nodes and records their state in PostgreSQL. Bitbucket Mesh keeps several replicas, each able to serve reads and writes.

Each of these designs coordinates write across replicas. In Spokes, the slowest replica set both the latency of a push and the throughput ceiling of the repository, and a distant replica lowered that ceiling further. Gitaly Cluster’s separate record of replica state can drift from what is on disk, and GitLab’s plan to replace Praefect and its database with Raft consensus inside Gitaly lists inconsistency as the first problem to solve.

GitHub’s response, described in October 2026, follows from git’s own rules. Git’s consistency requirements apply to each name separately: two pushes to different branches have nothing to agree about. Holding a lock on the whole repository for every update, network round trips included, turned the quorum into a single queue in which each write waited for every write before it. Moving to a quorum per name means only writes to the same name wait for each other.

The cost of keeping a store tidy

Immutable objects accumulate, and the host has to compact them. Git’s standard maintenance rewrites a repository’s objects into one large pack file. GitHub found in 2021 that for its largest and fastest-growing repositories the cost was quadratic: bigger repositories took longer to repack and also grew faster. The fix, contributed back to git, was to stop insisting on one pack. A multi-pack index lets git look objects up across many packs, reachability bitmaps were extended to cover them, and geometric repacking merges packs in tiers so that routine maintenance scales with the size of recent pushes. GitLab adopted the same approach in its own housekeeping.

Names have their own costs. In the same year, GitHub’s Project Cyclops traced push failures on large monorepos, its own included, to a lock held for twenty to thirty seconds while references were updated. One customer was planning to start again in a fresh repository with fewer references, in the hope that pushes would succeed. Cyclops raised GitHub’s capacity for push traffic on such repositories by at least an order of magnitude.

Content addressing also makes some savings free. Forks of a repository share most of their objects, so hosts store those objects once: GitLab links each fork to a hidden pool repository through git’s alternates mechanism, and GitHub keeps one object store per fork network. The saving has a side effect that follows directly from the design. Any object in the shared store can be fetched through any fork that shares it, because an object store answers requests by hash and has no notion of which repository a hash belongs to (kernel.org, which pools the objects of every fork of the Linux kernel, has documented this as expected behaviour).

Telling the client what exists

Before a fetch, the original git protocol had the server list every name in the repository with its hash. For a repository with a few branches that costs nothing; but with hundreds of thousands of names, kept for code review, CI and history, the list can dwarf the data the client actually wanted. Google, which hosts the Chromium and Android repositories, led the work on protocol version 2, released in git 2.18 in 2018. Version 2 drops the opening list and lets the client ask only for the names it cares about; Google reported no-op fetches of one branch running three times faster on repositories with 500,000 names, most of the gain coming from that filtering.

Repositories too large for one machine

The second direction of failure lands on the developer. Git copies the whole history to every clone and inspects every file in the working directory on common commands.

Microsoft met this when they moved Windows to git in 2017: about 3.5 million files, roughly 300GB, around 4,000 engineers. Its answer was the Git Virtual File System, which makes every file appear present but downloads each one only when it is first opened; a typical developer needed 50,000 to 100,000 of the 3.5 million. That work, and its successor Scalar, fed partial clone and sparse checkout into git itself, so that a client can fetch history without every file’s contents and check out only the directories it needs. Content addressing makes this process safe: a client missing an object can fetch it later by hash and verifying what arrives.

Meta took an alternative approach: Around 2012 its engineers found that git would not keep up with the growth of their monorepo, approached the git maintainers, and were advised to split the repository. They moved to Mercurial, whose developers were willing to work on scaling with them, and over the following decade turned it into Sapling, open-sourced in 2022 as a git-compatible client with its own storage formats, protocols and virtual filesystem. Google never adopted git for its main repository and runs its own centralised system, Piper.

Anthropic is the most recent departure. It reported in October 2026 that merged changes had risen from about 2,500 a day in May to over 30,000 a day in September, with each engineer typically running ten to fifteen coding agents in parallel. It had scaled git with hundreds of mirror servers, each holding the whole repository, and could scale no further once the repository outgrew the mirrors’ disks. Its replacement, Scion, stores changesets in Google Spanner and large files in Google Cloud Storage. Anthropic noted that its components could autoscale but had not yet needed to, because content-addressed data caches well.

Object storage underneath

The designs published in 2026 converge on one arrangement: object storage holds git’s objects in git’s own formats, local disks become caches, and the names live in whatever can provide compare-and-swap.

GitHub’s new architecture keeps pack data in Azure Blob Storage, and the names and the list of active packs in Ref-CAS, a small replicated service that stores pointers and never data. A push uploads its pack, then commits one transaction to Ref-CAS that adds the pack to the list and moves the names. Replicas hold only cached state; a replica asks Ref-CAS whether its view is current, and an unchanged repository costs one comparison. Separate compaction workers merge packs in Blob Storage and update the list. In internal testing GitHub measured 7,200 pushes per second to a single repository. The demand behind it is concrete: between September 2025 and August 2026, git activity on GitHub more than doubled, from 218.2 billion to 473.3 billion events a month.

GitLab’s design document for Gitaly, still a proposal, keeps the names in object storage too. Each repository’s pack files and name tables are immutable and stored under their own hashes; an immutable manifest lists the files that make up one consistent snapshot; an ordered sequence of small keys records which manifest is current. A writer uploads its files and publishes by creating the next key with a conditional write that fails if the key already exists. An earlier version used one pointer key updated in place, and was dropped because providers rate-limit updates to a single key (Google Cloud Storage allows one update per second per object).

Cursor’s Origin, described by Vicent Marti in August 2026, writes each push to S3 as part of a write-ahead log of immutable objects and to one local copy of the repository on NVMe disk; other replicas fetch changes as they need them. Netlify, building storage for repositories that its users and their agents create, keeps loose objects and pack files in S3 in git’s native formats and stores each name as a small JSON record. Names move only by S3’s conditional writes, objects are always uploaded before the names that point at them, and a pod whose local cache may be wrong after a failure discards it and rebuilds from S3.

Thomas Dohmke’s Entire takes the read side. Its network, in preview since July 2026, mirrors GitHub repositories into regional copies so that agents clone and pull from a nearby mirror while pushes still go to GitHub. Reads were always the easy half. Any number of copies of immutable objects can serve them.

Each generation of git hosting moved the objects somewhere cheaper to copy: from a shared disk, to replicated local disks, to object storage behind local caches. Each found that the names stayed where the agreement had to be, and that the cost of a system was set by how much agreement it demanded. The designs of 2026 demand the least so far. A push agrees on one name, or one manifest, through one conditional write, and everything else is copying.

References

One repository, one filesystem

Replicating whole repositories

The cost of keeping a store tidy

Telling the client what exists

Repositories too large for one machine

Object storage underneath


(Checklist: AI Readiness Assessment. Ten questions, five minutes. Find out where your organisation stands on AI (goals, data, sensitivity, ownership), with guidance on each answer.)

Questions about this? Get in touch.