A repository can use git large file storage ("git-lfs") to manage large data files.
The instructions on installing git-lfs for Mac, Windows, and some linux distros are available on the git-lfs GitHub repo Wiki. Since I did this work remotely on the HMS Research Computing Cluster, I do not have root access and had to install from source.
- Download the source code of the latest release from here.
wget https://github.com/git-lfs/git-lfs/releases/download/v2.7.2/git-lfs-v2.7.2.tar.gz
- Build the binary using
go build -o /path/to/dest/git-lfs
, where/path/to/dest/git-lfs
is the name of the directory you store your installed software in. This directory should be in your$PATH
. For instance, I used~/bin/git-lfs
.
module load go
go build -o ~/bin/git-lfs
There should now be a file with the same path and name that you passed using the -o
flag.
- Set up git-lfs in your git repository.
cd /path/to/my/git/repo
git lfs install
#> Updated git hooks.
#> Git LFS initialized.
- Declare which files to track.
git lfs track "*.bigfiles"
#> Tracking "really_big_file.bigfiles"
#> Tracking "so_big_such_wow.bigfiles"
#> Tracking "large_files_rock.bigfiles"
where "*.bigfiles"
is the regular expression for large files in the repo.
- Track ".gitattributes".
git add .gitattributes
git commit .gitattributes -m "start git-lfs"
You should now be able to add, commit, and push files like normal. Steps 1 and 2 only need to be done once per machine. Steps 3-5 need to be completed once per repository.