Skip to content
Latchkey

How to Speed Up Checkout of a Large Repository in CI

The biggest checkout wins are fetch-depth: 1, filter: blob:none, a scoped sparse-checkout, and turning off tag fetching.

Checkout time on a large repo is a stack of independent levers. Combine a shallow depth, a partial clone filter, a sparse working tree, and disabled tag fetching to get the smallest, fastest checkout a job can run with.

Checkout tuning table

InputEffectUse when
fetch-depth: 1clone only the tip commitno history needed (default)
filter: blob:nonedefer blob downloadneed history but not all files
sparse-checkoutmaterialize only some dirsjob builds one area
fetch-tags: falseskip fetching tagsmany tags, none needed

Combined workflow

.github/workflows/ci.yml
steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 1
      filter: blob:none
      fetch-tags: false
      sparse-checkout: |
        services/api

Gotchas

  • Do not stack flags a downstream step contradicts; a release job that reads tags cannot use fetch-tags: false.
  • Latchkey managed runners keep a warm git cache and auto-retry transient fetch failures, so cold clones hurt less.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →