How to Handle Large Binaries in CI Without Bloating Clones
Filter out heavy blobs with --filter=blob:limit=, keep binaries in LFS, or pull them from an external store instead of the clone.
Large binaries dominate clone size and every checkout pays for them. Options are a size-limited partial clone that skips them, moving them to Git LFS, or keeping them out of git entirely and fetching from object storage in the job that needs them.
Options
| Approach | How | Trade-off |
|---|---|---|
| Size-limited clone | --filter=blob:limit=1m | lazily fetches big blobs only when read |
| Git LFS | store binaries as LFS objects | separate bandwidth quota to manage |
| External store | download from S3/GCS in the job | not versioned with the commit |
Skip large blobs on clone
Terminal
git clone --filter=blob:limit=1m https://github.com/org/large-repo.gitFetch a binary from external storage
.github/workflows/ci.yml
- run: aws s3 cp s3://build-assets/models/model.bin ./assets/model.binGotchas
- A size-limited clone still fetches a big blob the moment a step reads it, so scope which steps touch them.
- External assets are not tied to the commit; pin a version so builds stay reproducible.
Related guides
How to Handle Git LFS in CI for a Large RepositoryFetch Git LFS objects correctly in GitHub Actions with the lfs: true checkout input, and control bandwidth so…
How to Choose Between a Blobless and Treeless Clone in CICompare blobless (--filter=blob:none) and treeless (--filter=tree:0) partial clones for CI, and pick the righ…