Git LFS and Unity

I was having a hard time with using The Great Fleece asset package in Unity with Git. There was an issue when I would try to push to the repo. Here is a step by step guide to get it all set up without having to delete files and all that.

Upon importing the asset package you’ll see this error:

To fix this I just double clicked the error in the console to bring me to the script with issues. Change the using Unity.Engine.PostProcessing; to using MinAttribute = UnityEngine.PostProcessingMinAttribute;. I am not sure why this works, but the error goes away. To find more information try reading through this article.

Everything seems all good now right? If you try to push your changes after importing this asset package you’ll get the following error:

So, long story short, the LightingData.asset file is too big. GitHub has a 100MB limit for pushing files. So we are going to need to install Git LFS. Here is the link to get it:

Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like or GitHub Enterprise.

Once installed go into Git Bash and type out git lfs install you should see something like this:

Change your current working directory to an existing repository you’d like to use with Git LFS. In my case, The Great Fleece project.

To associate a file type in your repository with Git LFS, enter git lfs track followed by the name of the file extension you want to automatically upload to Git LFS.

For example: the LightingData.asset file is a .asset file. So type out git lfs track "*.asset". You should then see something like this:

Now you need to add the file you want, in this case the Lighting Data file. So you’ll type out git add path/to/file.asset. In our case the “path/to/file” is going to be:

Assets/The Great Fleece/Game/_Scenes/Learning/Environment_Finished/LightingData.asset

Don’t forget to wrap this in a single quote. If your Unity project is called The Great Fleece, it needs to be wrapped because the spaces in the path will confuse Git. Youre command should look like this:

Once you’ve added it, commit your changes and push! Simple as that.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store