Skip to content
FR
  1. LuzineDebug
  2. Git & GitHub
  3. remote: error: File data/dump.sql is 512.00 MB;…
Git & GitHub Intermediate ≈ 20 min to fix

Fix "GH001: Large files detected" (file over 100 MB) on GitHub

Error message
remote: error: File data/dump.sql is 512.00 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage
  • remote: warning: File assets/video.mp4 is 62.00 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
  • remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
  • ! [remote rejected] main -> main (pre-receive hook declined)
  • batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.
In short

One of the commits you are pushing contains a file over 100 MB, GitHub’s limit. Deleting the file in a new commit is not enough: you must remove it from history (amended commit, git reset --soft, or git filter-repo), add it to .gitignore, or store it with Git LFS.

Be the first to confirm this fix

What this error means

GitHub checks every object received during a push: a file over 100 MB is refused by the pre-receive hook and the whole push is rejected (above 50 MB it is only a warning). Git sends the full history of commits the server does not have yet, not just the final state: if the large file was added in one commit and deleted in another, it is still part of the push. So the only fix is to rewrite the affected local commits so they no longer contain the file, or to store it with Git LFS, which replaces the content with a small pointer in Git.

Common causes

  1. Data or export file committed by mistake: SQL dump, CSV, .zip archive, video, machine-learning model.
  2. Generated folder not ignored: node_modules, build/, dist/, compiled binaries added by git add ..
  3. File deleted in a later commit: it still sits in an older commit that was never pushed.
  4. Git LFS quota exceeded: the file is tracked by LFS, but the account LFS storage or bandwidth is used up.

Step-by-step fix

  1. Identify the file and commits

    The message gives the path. List the unpushed commits and the ones that touch that file. The second command lists every object over 100 MB in history (macOS / Linux, or Git Bash on Windows).

    bash
    git log --oneline origin/main..HEAD -- data/dump.sql
    git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '$1 == "blob" && $3 > 100 * 1024 * 1024'
  2. Simple case: the file is in the last commit

    Remove it from the index without deleting it from disk, ignore it, then amend the commit.

    bash
    git rm --cached data/dump.sql
    echo "data/dump.sql" >> .gitignore
    git add .gitignore
    git commit --amend --no-edit
    git push
  3. The file is in several unpushed commits

    git reset --soft undoes the local commits while keeping all their changes staged: you commit them again as one, without the large file. Only your unpushed commits are rewritten.

    bash
    git fetch origin
    git reset --soft origin/main
    git rm --cached data/dump.sql
    echo "data/dump.sql" >> .gitignore
    git add .gitignore
    git commit -m "Add feature without large data file"
    git push
  4. Deeper history: git filter-repo

    Install git-filter-repo (brew install git-filter-repo or pip install git-filter-repo), back up the repository, then strip the oversized blobs from the whole history. The tool removes the origin remote as a safety measure: add it back. If already-pushed commits were rewritten, warn your team, since everyone will need to re-clone.

    bash
    git filter-repo --strip-blobs-bigger-than 100M
    # or remove one path everywhere
    git filter-repo --path data/dump.sql --invert-paths
    
    git remote add origin [email protected]:user/repo.git
    git fetch origin
    git push --force-with-lease origin main
  5. Alternative: BFG Repo-Cleaner

    BFG does the same in Java. It does not modify the latest commit by default: first remove the file from HEAD with git rm --cached and commit, then clean the history.

    bash
    java -jar bfg.jar --strip-blobs-bigger-than 100M
    git reflog expire --expire=now --all
    git gc --prune=now --aggressive
  6. If the file must be versioned: Git LFS

    Install Git LFS, track the file type, then convert the existing history with git lfs migrate. The files are then stored separately, within the LFS quota of your GitHub plan.

    bash
    git lfs install
    git lfs track "*.sql"
    git add .gitattributes
    git lfs migrate import --include="*.sql" --include-ref=refs/heads/main
    git push --force-with-lease origin main

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • Add dumps, exports, archives, node_modules and build folders to .gitignore from the start.
  • Read git status before each commit instead of blindly chaining git add . and git commit.
  • Store large files elsewhere: Git LFS, object storage (S3, R2), or GitHub Releases assets for distributed binaries.

Frequently asked questions

I deleted the file and committed, why does the push still fail?

Because the commit that added it is still part of the push. You must rewrite that commit (amend, reset --soft or filter-repo) so the file no longer appears in the history being sent.

What are GitHub’s size limits?

A warning from 50 MB, refusal above 100 MB per file from the command line, and 25 MB for a file uploaded through the browser. With Git LFS, the per-file limit depends on the plan.

The file contained sensitive data, is this enough?

If the file was never pushed, removing it from local history is enough. If it was pushed to another service or shared, consider the data exposed: rotate the affected passwords and keys in addition to the cleanup.

Useful tools for this error

More Git & GitHub errors

All Git & GitHub errors →