How to manage large files in Git with LFS
· Category: Git
Short answer
Git LFS replaces large files with text pointers in the repository, storing actual file contents on a remote server.
Steps
- Install Git LFS:
git lfs install
- Track file types:
git lfs track "*.psd"
git lfs track "*.zip"
- Commit the
.gitattributesfile and your large files normally. - Push; LFS uploads the file content separately.
Tips
- Check LFS status with
git lfs ls-files. - Migrate existing large files with
git lfs migrate. - Be mindful of LFS bandwidth and storage quotas on hosted platforms.
Common issues
- Missing LFS objects: run
git lfs fetchorgit lfs pull. - Without LFS installed, users see only pointer files, not the actual content.