Dealing with large files in Git

Esteban Ibarra
2 min readMay 22, 2021

--

I’m really excited to start on a new course on Unitys cinematography but I quickly discovered about gits 100mb limitation. Fortunately, there’s several solutions offered by those who came and stumbled before!:

The simplest solution offered by Troy Lyndon is after installing gits unity ignore file, you’de then pull it and edit a few lines into it to ignore GameDevHQ downloads:

/[Aa]ssets/GameDevHQ
/[Aa]ssets/GameDevHQ/
/[Aa]ssets/GameDevHQ*

I like this brute force solution as it pretty much eliminates any large project files from being uploaded in the first place.

I next found an article by Christopher West that talks about git-LFS.

Git LFS stands for Large File System and offers a method that instead of uploading a large file, it will create a pointer to it instead significantly reducing the amount of data needed to be uploaded.

git-LFS also uses a file, “.gitattributes” to know what files to skip not unlike .gitignore. This is done automatically once you start giving git-lfs commands to start tracking files.

One can install it by downloading it from the git-lfs website, I was able to install it by typing:

Next we initialize it in the command line, this only has to be done once.

Next we track the files we want git-lfs to keep track of using the command “git lfs track “*.ext”

I’m going to note Chris West’s article one more time and suggest installing thoughtbots .gitattributes file. It looks like this. I highly suggest just visiting the link and making a copy of the text yourself to avoid a lot of typing.

Thoughtbots .gitattributes file

After you’ve updated your .gitattributes file, be sure to add it FIRST to your repository.

and you’re good to go!

--

--