GitHub push fails due to oversized file that was previously removed

I’m having trouble pushing my code to GitHub because of a file size issue. Here’s my setup:

  1. Fresh GitHub repository
  2. Remote server repository (primary branch)
  3. My local repository

I cloned from my remote server to get the latest code locally. When I tried pushing to GitHub, it complained about data_backup.tar.gz being too big for their platform.

Since I didn’t need this archive file, I used Git commands to remove it from the cache and pushed the changes back to my remote server. The file doesn’t show up in my local directory anymore, and when I run git diff or git status, nothing appears. My server says everything is current when I push to it.

But when I attempt to push to GitHub, I still get this error:

remote: error: File data_backup.tar.gz is 135.17 MB; this exceeds GitHub’s file size limit of 100 MB

I tried the cleanup steps from GitHub’s documentation about large files. Why does this file still cause problems when it’s not showing up anywhere in my Git status or local filesystem? How can I completely eliminate it from my Git history so I can push successfully?

same thing happened to me too. github looks at your whole git history during push, not just your last commit. use git log --oneline --name-only to find which commits have the tar file. then you can do an interactive rebase (git rebase -i) to change them, or check out git filter-repo like the other users said. oh, and dont forget to backup your repo first – things can go sideways really fast!

The problem is that removing a file from your working directory doesn’t actually delete it from Git’s history. GitHub can still see it in your repo’s commit history when you try to push. When you deleted the file with regular Git commands, you only removed it from the current state - not from previous commits. That large file is still sitting in your branch’s history. GitHub scans everything during push operations, which is why it keeps finding the oversized file. You need to rewrite your Git history to completely remove the file. Use git filter-branch or the newer git filter-repo tool. These will scrub through every commit and eliminate the problematic file wherever it exists. Just heads up - rewriting history changes commit hashes. If teammates have copies of your repo, they’ll need to re-clone after you force-push the cleaned history. Make sure to coordinate with your team before doing this.

Git tracks your entire repo history, including deleted files from old commits. The file might be gone from your working directory, but it’s still buried in the commit history that gets pushed to GitHub. I ran into this exact problem last year with some video files I accidentally committed. GitHub’s pre-receive hooks scan everything you’re pushing, not just your current files. Just using git rm won’t help - that only affects new commits. You need BFG Repo-Cleaner (way faster and easier than git filter-branch). Download the jar file and run java -jar bfg.jar --delete-files data_backup.tar.gz your-repo.git. Then force-push with git push --force-with-lease origin main. Fair warning: this completely rewrites your history. Anyone else working on the repo will need to clone it fresh after you push the cleaned version.

Had this exact same issue when migrating to GitHub. The problem is Git stores complete repo history during pushes. Even though you deleted the file locally, GitHub still processes every commit that ever had that oversized file. Here’s what worked for me: I used git log --stat | grep data_backup.tar.gz to find exactly which commits had the problematic file. Then ran git rebase -i HEAD~[number] to edit those commits and remove the file completely. After cleaning up the commits, I had to force push since the commit hashes changed. The key thing - GitHub validates the entire push payload, including all historical commits, not just your current files. And heads up, coordinate with any collaborators since they’ll need fresh clones after you rewrite the history.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.