Course Tonight

Course Tonight

Did You Know?

Docy turns out that context is a key part of learning.

Chapter 46: Git Large File Storage (LFS)

Estimated reading: 2 minutes 5 views

Section 46.1: Declare certain file types to store externally

A common workflow for using Git LFS is to declare which files are intercepted through a rules-based system, just like .gitignore files.

Much of the time, wildcards are used to pick certain file types to blanket track.

For example, git lfs track "*.psd".

When a file matching the above pattern is added and committed, it will be uploaded separately when pushed to the remote. A pointer will replace the file in the remote repository.

After a file has been tracked with LFS, your .gitattributes file will be updated accordingly. GitHub recommends committing your local .gitattributes file, rather than working with a global .gitattributes file, to help ensure you don’t have any issues when working with different projects.

Section 46.2: Set LFS config for all clones

To set LFS options that apply to all clones, create and commit a file named .lfsconfig at the repository root. This file can specify LFS options in the same way as allowed in .git/config.

For example, to exclude a certain file from LFS fetches by default, create and commit .lfsconfig with the following contents:

[lfs]
 fetchexclude = ReallyBigFile.wav

Section 46.3: Install LFS

Download and install Git LFS, either via Homebrew or from the website.

For Homebrew, run the following commands:

brew install git-lfs
git lfs install

Often, you will also need to do some setup on the service that hosts your remote repository to allow it to work with LFS. This will be different for each host but will likely involve checking a box indicating that you want to use Git LFS.

Leave a Comment

Share this Doc

Chapter 46: Git Large File Storage (LFS)

Or copy link

CONTENTS