I had some large files in my github repository which I tried to add/commit/push but the push command gave the following error
remote: error: File app_dump.sql is 106.67 MB; this exceeds GitHub's file size limit of 100.00 MB
So I deleted the large file (app_dump.sql) from my repository and did again add/commit/push. But I think this was not the right thing to do, because whenever I push it will still try to push the large file?
$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
so now I get the same filesize error every time I push. How can I remove the file from git? I tried
$ git rm app_dump.sql
fatal: pathspec 'app_dump.sql' did not match any files
but this did not find any file, because I deleted it... thanks carl
Try reverting the commits you made:
git reset HEAD~1
This should undo 1 local commit. Undo your local commits until before the large file was included. Delete the large file. Commit your changes then push.
After deleting the file still stays in git commits, so you'll have to edit git history to remove the file from the commit where you have added it first.
Do an interactive rebase on the commit before it:
git rebase -i ThatCommitSha~1
and put edit
on the line with that commit (change "pick" to "edit" in the editor on the line with ThatCommitSha
, then save the file – See Docs.)git rm
the file and commit --amend
git rebase --continue
to link all next commits (they will be changed too, because the commit-with-file sha will change)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With