Git LFS is a command line extension and specification for managing large files with Git. The client is written in Go, with pre-compiled binaries available for Mac, Windows, Linux, and FreeBSD. Check out the Git LFS website for a high level overview of features.
You can install Git LFS several different ways, depending on your setup and preferences.
- Linux users can install Debian or RPM packages from PackageCloud.
- Mac users can install from Homebrew with
brew install git-lfs.
- Binary packages are available for Windows, Mac, Linux, and FreeBSD.
- You can build it with Go 1.5+. See the Contributing Guide for instructions.
Once installed, you can run
git lfs init to setup the global Git hooks
necessary for Git LFS to work. You can get help on specific commands directly:
$ git lfs help <subcommand>
The official documentation has command references and specifications for the tool.
Note: Git LFS requires Git v1.8.2 or higher.
Git LFS uses
.gitattributes files to configure which are managed by Git LFS.
Here is a sample one that saves zips and mp3s:
$ cat .gitattributes *.mp3 filter=lfs -text *.zip filter=lfs -text
Git LFS can manage
.gitattributes for you:
$ git lfs track "*.mp3" Tracking *.mp3 $ git lfs track "*.zip" Tracking *.zip $ git lfs track Listing tracked paths *.mp3 (.gitattributes) *.zip (.gitattributes) $ git lfs untrack "*.zip" Untracking *.zip $ git lfs track Listing tracked paths *.mp3 (.gitattributes)
Once setup, you're ready to push some commits:
$ git add my.zip $ git commit -m "add zip"
You can confirm that Git LFS is managing your zip file:
$ git lfs ls-files my.zip
Once you've made your commits, push your files to the Git remote:
$ git push origin master Sending my.zip 12.58 MB / 12.58 MB 100.00 % Counting objects: 2, done. Delta compression using up to 8 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 548 bytes | 0 bytes/s, done. Total 5 (delta 1), reused 0 (delta 0) To https://github.com/github/git-lfs-test 67fcf6a..47b2002 master -> master