【Unity】How to use Git LFS.

kento

KENTO⚽️XR Engineer😎

Posted on November 27, 2021

【Unity】How to use Git LFS.

Intro

If your a file is larger than 100MB, you will need to manage it with Git LFS.

I write the way down on this article about how to use Git LFS.
Since I have many opportunities to use Unity, I will write based this on a simple Unity sample.

Environments

name version
Unity 2020.3.4f1
Fork 1.69.3.0

What is Git LFS?

Git is a distributed version control system, meaning the entire history of the repository is transferred to the client during the cloning process. For projects containing large files, particularly large files that are modified regularly, this initial clone can take a huge amount of time, as every version of every file has to be downloaded by the client. Git LFS (Large File Storage) is a Git extension developed by Atlassian, GitHub, and a few other open source contributors, that reduces the impact of large files in your repository by downloading the relevant versions of them lazily. Specifically, large files are downloaded during the checkout process rather than during cloning or fetching.

【reference source】:Git LFS

In a nutshell, it makes it easier and more convenient to work with large files on git.

And we can not manage a large file without Git LFS.
【reference source】:About large files on GitHub

Experiment without Git LFS

We tested using Fork, a client tool for using git, to push a file larger than 100MB.

It failed as expected.
Image description

How to use

I use Git for Windows, which includes Git LFS, so I'll skip the installation steps.

First, copy the path to the large file.
Image description

Next, open the console and enter the following command.

$ git lfs track [path]
Enter fullscreen mode Exit fullscreen mode

If successful, ".gitattributes" will be added and the lfs message will be written.

Image description

If you have already created commit that contains a large file, you have to enter the following command.

$ git rm --cached [path]
Enter fullscreen mode Exit fullscreen mode

Other Resources

Git Large File Storage

💖 💪 🙅 🚩
kento
KENTO⚽️XR Engineer😎

Posted on November 27, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Future of HSEG
github Future of HSEG

November 12, 2022

【Unity】How to use Git LFS.
git 【Unity】How to use Git LFS.

November 27, 2021

GameOff #4 - Total destruction!
github GameOff #4 - Total destruction!

November 26, 2021