Git LFS Documentation
Git Large File Storage
Adding Large Files to Version Control with Git LFS
- Verify Git LFS is installed and initialized. Make sure git hooks are updated.
- Track the file types you want associated with Git LFS. This will update the
.gitattributes file.
git lfs track "*.<file extension type>"
- It is also good to commit the
.gitattributes file to update the changes.
git add .gitattributes
git commit -m "<insert commit message>"
- You may need to rewrite the history to remove the original non-LFS commits of large files.
git rm --cached "<path to large file>"
git add .
git commit -m "<insert commit message>"
- Re-include the large file path for LFS handling.
git add "<path to large file>"
git commit -m "<insert commit message>"
- Another alternative is to use LFS migrate to automate the process.
git lfs migrate import --include="*.<file extension type>"
- Lastly, push the latest commits to your remote origin.
- Note that you may need to force push the commits and that the history may be rewritten.
git push origin main --force