Git Large File Storage (LFS)

LFS is a comfortable and efficient way to store large binaries.


Without LFS

  • every git repository contains the complete history of all files including every version of big binaries
  • cloning such a repository requires to download all these binaries in all versions
  • bad performance of Git repositories larger than 1GB

With LFS

  • same git commands can be used, the LFS binaries are automatically downloaded
  • only pointers to the binary data are stored in the repository, the binaries ares stored on a separate disk on the server
  • only one version of large binaries will be downloaded, if the repository is cloned

Rejected Files

On the JSC gitlab server, a single file may not exeed the size of 20Mb, otherwise the push will be rejected. You have to undo the rejected commit and commit them using LFS.

Usage of Git LFS


  • check if git lfs client is installed git lfs version otherwise install lfs client
  • setup git lfs: git lfs install

First usage

This command specifies the files which should use LFS and also creates or updates .gitattributes.

git lfs track "*.bin" # or git lfs track myBigFile.bin

Important: Add .gitattributes to the repository.

git add .gitattributes

Further usage

Now you may use git like before to add a file to the repository.

git add myBigFile.bin
git commit -m "Add binary file using lfs"
git push origin master

Useful commands

If you have many LFS objects, cloning with git lfs clone is faster.

git lfs clone

If you have already checked out a repository and want to replace the object links (e.g. ExamplePointerFile) with the binary contents, use git lfs pull or

git lfs fetch # downloads objects with batch mode
git lfs checkout # changes objects to binary files

Show files which use LFS

git lfs ls-files



For further questions, send an email to