git large file storage lfs

git large file storage lfs

Guide

Git LFS lets you store files up to 2 GB in size instead of normal 50 MB.

install

download git-lfs-linux-amd64-v2.7.2.tar.gz from git lfs

tar -xzvf git-lfs-linux-amd64-v2.7.2.tar.gz
chmod +x install.sh
sudo ./install.sh
#Git LFS initialized.

usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
To get started with Git LFS, the following commands can be used.

1. Setup Git LFS on your system. You only have to do this once per
repository per machine:

git lfs install

2. Choose the type of files you want to track, for examples all ISO
images, with git lfs track:

git lfs track "*.iso"

3. The above stores this information in gitattributes(5) files, so
that file need to be added to the repository:

git add .gitattributes

3. Commit, push and work with the files normally:

git add file.iso
git commit -m "Add disk image"
git push

issue the commands

>git lfs install
Updated git hooks.
Git LFS initialized.

>git lfs track "*.pdf" 
# generate .gitattributes file

>cat .gitattributes
*.pdf filter=lfs diff=lfs merge=lfs -text


>git add .gitattributes

>git add file.pdf
>git commit -m "Add pdf file"
>git push

Reference

History

  • 20190719: created.