Skip to the content.

Problem: fetches are too slow

Symptoms:

Validate network topology

Allow maintenance to complete

In narrow cases, having too many incoming pushes per unit of time can cause fragmentation of indexes due to maintenance not completing. This in turn can cause all fetch operations to slow down.

Use background maintenance on clients

Developer machines typically have network access most of the time, so Git object data can be fetched in the background. If a developer runs git maintenance start in their repository, this enables several background maintenance tasks, including the prefetch task. By default, this task fetches new objects from the origin server on an hourly basis, leading to the developer not waiting as long to get the latest refs during their foreground git fetch and git pull commands.

Shallow your directory structure

A deeply-nested directory structure can bloat a repo more quickly, and sometimes in ways that don’t deltafy well. For example, consider:

|- dir1
|    |- file1.txt
|
|- dir2
     |- dir3
          |- dir4
               |- file2.txt

When you commit a change to file1.txt, Git has to track four new objects:

When you instead commit a change to file2.txt, Git has to track six new objects:

In a simple example like this, it makes no difference whether Git creates 4 or 6 objects. But if on average most of your changes are nested 6-10 levels deep, over time, that drives a lot more growth of the repo than having changes nested 1-5 levels deep.

👈 Back to solutions | 🏠 Back to front page