This article introduces the installation and use of git-lfs tool on the linux platform.
The purpose of Git Large File Storage (LFS) is to better integrate large binary files, such as audio files, datasets, images and videos, into Git workflows. We know that Git is not efficient at storing binaries because it compresses and stores all full versions of binaries, which is not optimal as versions grow and binaries become more numerous. And the way LFS handles large binary files is by replacing them with text pointers, which are actually text files containing binary file information. The text pointers are stored in Git, while the large files themselves are hosted on the Git LFS server via HTTPS.
Installation
Install git-lfs the easy way, just use the apt package management system。
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
Verify the installation was successful.
git lfs
If the installation is successful, the above command will output the instructions for using git-lfs.
Track files
Change to your project repository directory.
Following command enables git-lfs in your project.
git lfs install
Following command make git-lfs track all “.so” file in your project.
git lfs track *.so
Tracked files will be logged to “.gitattributes”, you can also edit it to add or remove tracked files.
vi .gitattributes
Commit
This step is the same as usual.
git add .
git commit -m "commit notes"
git push
View tracked files
Following command shows files that tracked by git-lfs.
git lfs ls-files