Git LFS Overview

July 24, 2017

Git LFS is an extension to track and manage large binary files inside of a normal git projects.  This extension replaces tracked files with a small pointer file and stores the content of the file in another location that is better suited for such types of files.

How Git LFS Works

Git LFS works by storing certain files in a separate location that is better suited for these larger files.  To do this, each user must have the Git LFS extension installed and working on their computer to be able to clone and edit files tracked by LFS.  When cloning a git project that has LFS enabled, Git LFS will automatically upload and download tracked files as needed.  Only the most recent copy of each tracked file is kept on the user's machine, so disk space and download times are kept to a minimum.

Git LFS can be used to track any kind of file, but you must tell Git LFS which files you would like to track before it will follow and manage a type of file.

Git LFS Limitations

Git LFS is easiest to setup when used on new projects.  If you need to convert an existing project into an LFS project, follow this guide (Coming Soon).

Since files tracked by Git LFS are stored in a separate location, you may notice slower performance when performing some actions on your repository.

Cloning new projects with lots of files can be slow with Git LFS due to a limitation in the Git LFS program.  To work around this, you can clone the project and disable Git LFS and clone the files separately.

GIT_LFS_SKIP_SMUDGE=1 git clone sthse@sthse.co:/code/your/project.git

cd project

git lfs pull

Enabling and Using Git LFS

To enable Git LFS on your Storehouse Project, navigate to the Settings page and enable the LFS module.  Since LFS is a git extension, it can only be enabled on git projects.  Once enabled, make sure the LFS extension is installed on your computer.

To have Git LFS track a particular file type, issue git lfs track '*.jpg', replacing .jpg with the file extension you would like to track.  When you add and commit files of this type, Git LFS will automatically handle storing the files correctly.