Using Git Large File Storage (LFS)

I came across a problem when using Git with Unity. Git has a file size limit of 100 MB. This will make uploading things like large asset files an issue. That is when I came across Git LFS. This is an add-on that will allow you to save large files.

To use Git LFS

  • Now that it is installed go to the file of the Unity project you have connected to your git repository and open git bash there
  • Now install Git LFS using the command “git lfs install”
This part only needs to be done once per account
  • Now you will want to create a .gitattributes file that will track the files you want Git LFS to manage
  • Type “git lfs track “*.psd”” to create the file
  • Now you can use “git lfs migrate import” on these files
  • The last thing that might happen when you migrate your files and commit that change is that you will load your scene in unity and all your assets in your scene are gone. You will get an error saying it failed to load because it was serialized with a newer version of unity.
  • If this happens you will have to go through the commit process again and use “git lfs pull” => https://github.com/git-lfs/git-lfs/issues/2594
  • type “git lfs pull origin main”
  • check your status to make sure you are up to date.
  • type “git lfs push origin main”

This should fix that problem and you should be good to go.

Unity Game Developer and C# Programmer