git lfs Command: Large Files in CI
git lfs (Large File Storage) replaces big files with pointers and fetches their content on demand.
When a repo uses LFS, a plain clone gives you pointer text files instead of real assets. CI must initialize LFS and pull the objects, or the build sees placeholder files.
Common flags
install- set up the LFS hooks and filters for the user or repoinstall --local- install hooks only for the current repositorypull- download LFS objects and replace pointers in the working treefetch- download LFS objects without updating the working treecheckout- populate working-tree files from already-fetched objectsenv- print LFS configuration for debugging
Example
shell
# Ensure LFS assets are real files, not pointers, in CI
git lfs install --local
git lfs pullIn CI
If a build fails because an image or binary is a tiny text file starting with "version https://git-lfs", LFS was not pulled. Run git lfs install then git lfs pull (or set lfs: true in your checkout action). Caching LFS objects between runs avoids re-downloading large assets.
Key takeaways
- Without git lfs pull, CI sees pointer files instead of real large assets.
- git lfs install sets up the filters; git lfs pull fetches the content.
- A text file starting with "version https://git-lfs" is an unpulled pointer.
Related guides
git clone Command: Clone Repos in CIgit clone copies a remote repository into a new directory. Reference for --depth, --branch, --filter, and --r…
git checkout Command: Switch Refs in CIgit checkout switches branches or restores files. Reference for checking out a branch, --detach, and -b to cr…
git fetch Command: Update Refs in CIgit fetch downloads objects and refs from a remote without merging. Reference for --depth, --unshallow, --tag…
git archive Command: Export Trees in CIgit archive exports a tree as a tar or zip. Reference for --format, --prefix, and pathspecs to build clean so…