How to add Git LFS to a project

Oscar de la Hera Gomez
Two flowers that represent Terminal and Git side by side. Beneath them sits the text "Initialize git lfs."

A step by step guide on adding git large file storage (lfs) to a project using Terminal.

Step One: Install Git LFS

A screenshot of Terminal showing you how to install Git LFS using homebrew.

Open Terminal and install Git LFS the following line:

brew install git-lfs

If you do not have homebrew, consult the git lfs install guide or install homebrew using the links below.

Step Two: Set the Current Directory

A screenshot of terminal showing you how to set the current directory.

In Terminal, set the current directory to the folder that holds the repository.

cd path/to/your/repository

Step Three: Track Files

A screenshot of Terminal showing you how to track all the .png files.

To start using git lfs you must associate it with a file, or type of file in your repository.

Track File Types

To track all file types (i.e. all pngs) use a line similar to that below.

git lfs track "*.filetype"

Track Specific Files

To track specific files, use a line similar to that below. Please note that the path is relative to the project.

git lfs track "path/to/file.filetype"

Untrack files

If something went wrong and you want to untrack files or file types, use a line similar to that below.

git lfs untrack "pattern"

Make changes outside terminal

To make changes without using Terminal, edit the .gitattributes file.

Step Four: Sync

A screenshot of terminal showing you how to sync the changes and push them to your repository.

Finally, sync the changes with your repository to complete the changes.

git add .; git commit -m "message"; git push origin main

Did something go wrong ?

Consult our troubleshooting Git LFS guide to resolve your problem.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details