Git Large File Storage
Introduction
Git was originally designed for small file storage. However, in some scenarios, uploading some large files is inevitable. Git Large File Storage (Git-LFS) was invented to make large file storage on Git fast and reliable. When I first use Git-LFS, I found it confusing. Because I don’t use it frequently, I forgot how to use it from time to time. So in this blog post, I will document the basic protocols of using Git-LFS. For more comprehensive usages, please go to the reference section.
Installation
The installation is extremely simple on Linux. Run the following command and you should be good to go.
1 | curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash |
Upload Files
To upload large files to Git server, in the Git repository root directory, run the following commands.
1 | # Git-LFS initialization |
Download Files
To download the Git repository containing large files, please make sure that Git-LFS was installed beforehand. Otherwise, the repository you cloned will only contain the shortcuts of the large files. Installing of Git-LFS after the repository was cloned will not help. git pull
and git fetch
will not automatically replace the shortcuts to large files for you. If you have already cloned the repository, just delete the repository, make sure Git-LFS is correctly installed, and clone again. In this way, the large files will be cloned correctly.
References
Git Large File Storage