Skip to content

How to Fix Git LFS Not Tracking Files Error

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix Git LFS Not Tracking Files Error. We cover key concepts, practical examples, and best practices.

You set up Git LFS but large files are still being stored in the repository directly — the LFS tracking patterns are not configured correctly or the .gitattributes file was not committed.

The Problem

git lfs ls-files

Shows no files, but you have large binary files in the repository.

Or:

git lfs track "*.psd"

But pushing still uploads the full file content.

Step-by-Step Fix

Step 1: Install and initialize Git LFS

git lfs install

Step 2: Track the correct file patterns

# Track by extension
git lfs track "*.psd"
git lfs track "*.zip"
git lfs track "*.bin"

# Track by filename
git lfs track "large-file.dat"

Step 3: Commit .gitattributes

The git lfs track command modifies .gitattributes. Commit it:

git add .gitattributes
git commit -m "Configure Git LFS tracking"

Step 4: Track files already in the repository

For files that were already committed before LFS was configured:

git lfs migrate import --include="*.psd" --everything

Step 5: Verify tracked patterns

git lfs track

Expected:

Listing tracked patterns
    *.psd (.gitattributes)
    *.zip (.gitattributes)

Step 6: Check the .gitattributes file

cat .gitattributes

Expected:

*.psd filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

Step 7: Push LFS files

git push --all

Prevention Tips

  • Configure LFS before adding large files to the repository
  • Commit .gitattributes changes before adding LFS-tracked files
  • Use git lfs migrate to retroactively fix existing large files
  • Verify tracking with git lfs ls-files before pushing
  • Set up LFS in project setup documentation

Common Mistakes with lfs error

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world GIT code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### How do I check which files are currently tracked by LFS?

Run git lfs ls-files --all to list all files tracked by LFS. Run git lfs track to see the configured patterns. The .gitattributes file shows the actual pattern-to-filter mapping.

Why did my LFS migration not work?

Common issues: LFS was not initialized with git lfs install, the .gitattributes was not committed, or the migration command was run on the wrong branch. Run git lfs migrate info to see which files would be affected.

Can I stop tracking a file with LFS?

Yes. Remove the pattern from .gitattributes, commit the change, and run git lfs migrate export --include="*.psd" --everything to move files back to regular Git storage.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro