---
title: "What is Git LFS (Large File Storage)? How is it used in GitHub?"  
description: "What is Git LFS (Large File Storage)? How is it used in GitHub?"  
author: "Shalini Passi"  
published: 2025-07-04  
updated: 2026-05-10  
canonical: https://www.mindstick.com/forum/161788/what-is-git-lfs-large-file-storage-how-is-it-used-in-github  
category: "GitHub"  
tags: ["github", "git"]  
reading_time: 5 minutes  

---

# What is Git LFS (Large File Storage)? How is it used in GitHub?

**What is Git LFS ([Large](https://www.mindstick.com/interview/34471/what-is-a-large-language-model-llm) [File Storage](https://www.mindstick.com/interview/34449/difference-between-object-block-and-file-storage))? How is it used in GitHub?**

## Replies

### Reply by ICSM Computer

## What is Git LFS (Large File Storage)?

Git LFS ([Large File](https://www.mindstick.com/interview/34121/how-can-you-track-progress-while-copying-a-large-file) [Storage](https://www.mindstick.com/articles/44536/finding-your-self-storage-facility)) is an extension for Git that helps manage large files efficiently inside Git repositories.

Normally, Git is optimized for:

- Source code
- Text files
- Small assets

But Git performs poorly with large binary files such as:

- Videos
- ZIP files
- PSD files
- Machine learning models
- Game assets
- Large datasets

This is where Git LFS becomes useful.

## Why Git Struggles with Large Files

Git stores the complete history of every file version.

For large binary files:

- Repository size grows rapidly
- Clone operations become slow
- Fetch/pull performance degrades
- Storage usage increases significantly

Example:

```plaintext
video.mp4 → 500 MB
10 versions → 5 GB history
```

Git downloads all versions when cloning.

## What Git LFS Does

- Git LFS replaces large files in Git with lightweight pointer files.
- Actual large files are stored separately on a remote LFS server.

Instead of storing:

```plaintext
movie.mp4 (500 MB)
```

Git stores:

```plaintext
Pointer file
```

Example pointer:

```plaintext
version https://git-lfs.github.com/spec/v1
oid sha256:abcd1234...
size 524288000
```

The real file is downloaded only when needed.

## How Git LFS Works

## Without Git LFS

```plaintext
Git Repo
 ├── video.mp4 (500 MB)
 ├── model.bin (2 GB)
 └── assets.psd
```

Repository becomes huge.

## With Git LFS

```plaintext
Git Repo
 ├── video.mp4 (pointer file)
 ├── model.bin (pointer file)
 └── assets.psd (pointer file)

LFS Storage Server
 ├── actual video.mp4
 ├── actual model.bin
 └── actual assets.psd
```

## Benefits of Git LFS

## Smaller Repository Size

Git repository stays lightweight.

## Faster Cloning

Only required large files are downloaded.

## Better Performance

Improves push/pull operations.

## Easier Collaboration

Teams can work efficiently with media assets.

## Common Use Cases

Git LFS is widely used for:

- Game development
- AI/ML models
- Large datasets
- Video editing projects
- Design assets
- Audio production
- CAD files

## How to Install Git LFS

Official website:

Git LFS Official Website

## macOS

```plaintext
brew install git-lfs
```

## Windows

```plaintext
git lfs install
```

(After downloading installer)

## Linux

```plaintext
sudo apt install git-lfs
```

## Initialize Git LFS

Inside repository:

```plaintext
git lfs install
```

This enables Git LFS support.

## Track Large Files

Example:

```plaintext
git lfs track "*.psd"
```

Track videos:

```plaintext
git lfs track "*.mp4"
```

Track ML models:

```plaintext
git lfs track "*.bin"
```

This creates:

```plaintext
.gitattributes
```

Example:

```plaintext
*.mp4 filter=lfs diff=lfs merge=lfs -text
```

## Add and Commit Files

```plaintext
git add .
git commit -m "Add large assets"
git push
```

Git uploads:

- Pointer files to Git repository
- Actual files to LFS storage

## How GitHub Uses Git LFS

GitHub provides built-in support for Git LFS.

When you push LFS files:

- GitHub stores pointers in Git repo
- Large binaries are stored in GitHub LFS storage

## Example Workflow in GitHub

## Step 1

Install Git LFS:

```plaintext
git lfs install
```

## Step 2

Track file types:

```plaintext
git lfs track "*.zip"
```

## Step 3

Commit changes:

```plaintext
git add .gitattributes
git add largefile.zip
git commit -m "Add large ZIP"
```

## Step 4

Push to GitHub:

```plaintext
git push origin main
```

GitHub automatically uploads LFS objects.

## Viewing LFS Files on GitHub

In a GitHub repository:

Large files show an LFS badge.

Example:

```plaintext
Stored with Git LFS
```

## Git LFS Storage Limits on GitHub

GitHub provides limited free storage and bandwidth for LFS.

Current limits may vary, but generally:

- Storage quota
- Monthly bandwidth quota

Official pricing/details:

[GitHub LFS Billing Documentation](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage?utm_source=chatgpt.com)

## Git LFS Commands

## List tracked files

```plaintext
git lfs ls-files
```

## Fetch LFS files

```plaintext
git lfs fetch
```

## Pull actual LFS content

```plaintext
git lfs pull
```

## Clone repository with LFS

```plaintext
git clone <repo-url>
```

Git automatically downloads required LFS objects.

## Important Notes

## Git LFS is NOT a Replacement for Cloud Storage

Avoid storing:

- Database backups
- Massive archives
- Frequently changing huge binaries

Better options:

- S3
- Azure Blob Storage
- Google Cloud Storage

## Best Practices

## Track Only Necessary Files

Avoid excessive LFS usage.

## Use `.gitignore`

Prevent accidental uploads.

## Avoid Huge Histories

Large frequently changing binaries can still increase costs.

## Use Releases for Big Downloads

For distributable binaries, GitHub Releases may be better.

## Git LFS vs Normal Git Storage

| Feature | Git | Git LFS |
| --- | --- | --- |
| Large File Handling | Poor | Excellent |
| Repository Size | Grows Fast | Optimized |
| Clone Speed | Slow | Faster |
| Binary File Support | Limited | Designed For It |
| Storage Model | Inside Repo | External Storage |

## When Should You Use Git LFS?

Use Git LFS if your repository contains:

- Files larger than 50–100 MB
- Binary assets
- AI models
- Design files
- Multimedia assets

## Final Thoughts

Git LFS solves one of the biggest limitations of Git by handling large binary files efficiently.

It is especially useful for:

- AI projects
- Game development
- Media-heavy applications
- Design teams
- Data science workflows

Combined with [GitHub](https://github.com/?utm_source=chatgpt.com), Git LFS provides a scalable workflow for managing large assets while keeping repositories fast and manageable.

## Official Documentation

- Git LFS Documentation
- [GitHub Git LFS Docs](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-git-large-file-storage?utm_source=chatgpt.com)
- Git Official Website


---

Original Source: https://www.mindstick.com/forum/161788/what-is-git-lfs-large-file-storage-how-is-it-used-in-github

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
