Git, CI/CD & GitOpsCII · Large Repository PerformanceLFS
Git LFS fundamentals — pointers and object storage
What you'll learn
- Explain the pointer model that LFS uses to substitute the contents of a large blob
- Install Git LFS, track a file pattern, and verify the substitution with `git lfs ls-files`
- Recognise what does and does not migrate when a tracked file is added
- Apply the LFS workflow for an engineer workstation and a CI runner
Prerequisites
Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x
Git LFS does not make the repository smaller. It
moves the cost: large contents live in an external
object store, Git tracks small pointers. Bandwidth
shifts from git clone to git lfs pull; workflow
shifts from git-native to LFS-aware; storage shifts
from disk to a billed service.
The pointer model
When a file is LFS-tracked, Git commits a small text file: the LFS pointer.
version https://git-lfs.github.com/spec/v1
oid sha256:<hash>
size <bytes>
The oid is the SHA-256 of the contents; contents
live in the LFS object store. A clone without git lfs pull reads pointers, not contents.
flowchart LR
A["working tree"] -->|commit| B["pointer in Git"]
B --> C["Git packfile"]
B -->|"oid maps to"| D["LFS object store"]
D -->|"git lfs pull"| A
The packfile holds the pointer. The object store
holds the bytes. git lfs pull resolves pointers
into real files.
Install, track, commit
git lfs install
git lfs track "*.bin"
git add .gitattributes
git add assets/data.bin
git commit -m "Track data.bin through LFS"
git lfs install installs clean/smudge filters once
per user. git lfs track writes the pattern to
.gitattributes; commit that file so teammates get the
same filters.
git lfs ls-files
git lfs fetch
git lfs pull
git lfs prune
lfs ls-files lists tracked files with oids; lfs fetch downloads without checkout; lfs pull
materialises; lfs prune removes orphans.
CI integration
A CI runner must fetch LFS objects before the build reads files. Without it, the build reads pointers and fails.
steps:
- uses: actions/checkout@v4
with:
lfs: true
- run: git lfs pull
lfs: true tells checkout to fetch LFS objects.
Production discipline
- Track deliberately: rarely-revised immutables.
- Commit
.gitattributesimmediately. - Migrate history only with planned rewrite.
- Pre-warm CI runners.
Cross-course references
- Ansible for Production Sysadmins Part XXXVII: collections pinned by tag.
- Terraform for Production Sysadmins Part IX: state in a backend.
Quiz
Quiz
Knowledge check · 4 questions
Q1. A repo tracks `*.bin` through LFS. An engineer clones but forgets `git lfs pull`. What do they see?
Q2. Adding `*.bin` to `git lfs track` migrates every existing `*.bin` in history from ordinary blobs to LFS pointers.
Q3. Name the three lines of an LFS pointer file, and identify the command that lists tracked files with their LFS oids.
Q4. Diagnose why CI builds fail with file-format errors despite a successful clone, and propose the fix.
Team H: Terraform monorepo tracks `.bin` provider plugins through LFS. `terraform plan` fails with `provider plugin: file format error`. Clone reports success.
Passing score: 75%. Answers are checked in this browser.