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
| Input | Effect | Use when |
|---|---|---|
fetch-depth: 1 | clone only the tip commit | no history needed (default) |
filter: blob:none | defer blob download | need history but not all files |
sparse-checkout | materialize only some dirs | job builds one area |
fetch-tags: false | skip fetching tags | many 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/apiGotchas
- 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
How to Do a Shallow Clone in CI for a Large RepositorySpeed up checkout of a large repository in GitHub Actions with fetch-depth: 1 for a shallow clone, and learn…
How to Cache the Git Repository Between CI RunsCache the .git directory in GitHub Actions with actions/cache so a large repository fetches only new objects…