GitHub rejects a file over 100 MB
What just happened
A big file (video, dataset, build, node_modules…) is in one of your unpushed commits. Deleting it in a new commit is not enough: it is still in the history Git tries to send.
Potential risks
- Rewriting already-pushed commits affects your teammates.
Before you run anything
- Need to version big files? Use Git LFS instead.
- Golden rule: before any destructive command, create a safety branch with git branch backup/before-fix — it costs nothing.
Recovery steps
- 1
Find the commit that added it
Lists the local commits not yet on the remote, with their files.
Safe$ git log --stat origin/main..HEAD - 2
It's in the last commit
Remove it from the commit but keep it on disk, then ignore it.
Caution$ git rm --cached path/to/big-file$ echo "path/to/big-file" >> .gitignore$ git commit --amend --no-edit - 3
It's in an older unpushed commit
Rewrites every unpushed commit to drop the file. Needs git filter-repo (installed separately); --force because this is not a fresh clone. Make a backup branch first.
Destructive$ git branch backup/before-fix$ git filter-repo --force --invert-paths --path path/to/big-file --refs origin/main..HEAD
These procedures are provided for information only. Read each command and adapt it to your situation before running it. Disclaimer