Gangmax Blog

自由之思想,独立之精神

Git Large File Storage

| Comments

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 GitHub.com or GitHub Enterprise.

In my case I want to save a sqlite db file with LFS. Here is the commands I use.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 1. Install LFS. From: https://packagecloud.io/github/git-lfs/install
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
# 2. Remove the db file from the existing git repository. 
cd .newsbeuter
rm cache.db
git commit -m 'Remove the cache.db for later using lfs support.'
# 3. Initialize the lfs feature.
git lfs install
# 4. Declare to use lfs with the "*.db" files.
git lfs track "*.db"
# 5. Read the file content without modification.
vi .gitattributes
# 6. Add the "cache.db" file again.
mv ../cache.db .
git commit -m 'Use the Github lfs support to store the cache.db file.'
# 7. Push to the remote git repository.
git push origin master

I don’t know why that, after I enable LFS feature, I have to type the username/password THREE times instead of once after running “git push” command.

Here is the LFS specification document, in which more details are given.

Comments