Git Large File Storage
How to setup Git LFS for your unity project
We just started our new project. So we setup GitHub for our new project. Since we don’t do this every day we used our own old article as a reminder.
While trying to setup our git we got an error stating some files are too large for our first push. Either we pay up or look for another solution.
After some digging we found: Git LFS
Git LFS is a Git extension used to manage large files and binary files in a separate Git repository. Most projects today have both code and binary assets. And storing large binary files in Git repositories can be a bottleneck for Git users. That’s why some Git users add Git Large File Storage (LFS)
Install Git LFS
Download using the link below and follow the instructions below.
Assuming you already got (normal) git installed.
Go to your project folder > R-Click > Git Bash Here
git lfs install
Configure Git LFS
When we tried to push we got an error stating an .asset file was too large. So let’s add the .asset file type to our track list.
git lfs track “*.asset”
Now make sure .gitattributes is tracked:
git add .gitattributes
If you already have a local commit that needs has large files that need to be tracked by Git LFS you need to do some additional steps. Otherwise you can just start creating commits like normal Git.
Migrate existing commits to Git LFS
With the line below we can get a list of the larger files.
git lfs migrate info
To convert any pre-existing files to Git LFS use:
git lfs migrate import
Check the status with:
git status
If needed use
git add .
and
git commit -m “LFS”
Push Git LFS
If git status return nothing to work on just push.
git push origin main
Go to Git Hub and check if it completed successful.