Class 46 of 50 • DevOps & CI/CD

Git LFS (Large File Storage): Tracking Video, Datasets & Binary Assets

Git was designed for source code (plain text files). When you commit large binary files—such as 4K video clips, 3D graphics assets, raw datasets, or 500MB machine learning models—standard Git bloats rapidly because it stores full copies of every version in .git/objects/. Furthermore, GitHub rejects any file over 100MB. The solution is Git LFS (Large File Storage).

How Git LFS Works

Git LFS replaces large files inside your Git repository with lightweight text pointer files (about 130 bytes). The actual heavy binary data is uploaded to dedicated cloud media storage (e.g. GitHub LFS storage or AWS S3):

# What Git actually stores inside your repo instead of the 200MB video:
version https://git-lfs.github.com/spec/v1
oid sha256:4d7a92b184e03d...
size 209715200

When you clone or checkout, Git LFS downloads only the specific binary assets needed for your currently checked-out commit, keeping your repository lightweight and blazing fast!

Installing and Configuring Git LFS

# Step 1: Install Git LFS extensions on your system
$ git lfs install
Updated Git hooks.
Git LFS initialized.

# Step 2: Configure Git LFS to track specific file extensions
$ git lfs track "*.psd"
$ git lfs track "*.mp4"
$ git lfs track "*.onnx"
$ git lfs track "assets/models/**"

# Step 3: Git LFS records these rules in a .gitattributes file. Commit it!
$ git add .gitattributes
$ git commit -m "chore: configure Git LFS for video and model assets"

Working with Git LFS Files

Once configured, you use standard Git commands! You add, commit, and push normally:

$ git add video.mp4
$ git commit -m "feat: add promotional onboarding video"
$ git push origin main
Uploading LFS objects: 100% (1/1), 185 MB | 12 MB/s, done.

Cloning Repositories that Use LFS

# Modern Git LFS downloads assets automatically during clone:
$ git clone https://github.com/user/heavy-project.git

# To pull LFS binaries manually if missing:
$ git lfs pull

GitHub File Size Limits to Remember

  • 50MB: GitHub displays a warning in terminal upon push.
  • 100MB: GitHub's server strictly blocks and rejects the push entirely!
  • Files larger than 100MB must use Git LFS.

Explore Related Git & GitHub Tutorials & Next Steps

Strengthen your version control mastery by studying these connected classes:

Git Ignore Rules (.gitignore)

Decide when to ignore binary files vs when to track them via Git LFS pointers.

Git Blob Storage & Packfiles

Understand why large binary files cause standard Git repositories to bloat.

Pushing & Pulling with Git LFS

Learn how Git LFS downloads binary assets on demand from remote media servers.

Troubleshooting Git LFS Quotas

Resolve GitHub bandwidth limits and handle large files committed accidentally.

Frequently Asked Questions (FAQ) - Student & Interview Review

`.gitignore` tells Git to completely ignore files so they are never tracked or uploaded anywhere. Git LFS tracks and versions files, uploading them to remote storage while keeping the Git repository database small.
GitHub includes 1GB of free Git LFS storage and 1GB of free monthly bandwidth for all accounts. Additional storage and bandwidth can be purchased through data packs.
Run `git lfs ls-files`. This prints the list of all files currently tracked as LFS pointers, their commit hashes, and file sizes.

Next Step in Your Git & GitHub Learning Path:

Advance your software engineering skills with the next topic in our synchronized curriculum.

Continue to 30+ Lab Practice Scenarios → Previous: ← Git Branching Strategies | Full Syllabus

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!