Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

this exceeds GitHub's file size limit [duplicate]

Tags:

git

github

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

like image 707
carl Avatar asked Feb 06 '16 12:02

carl


2 Answers

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.

like image 50
John Bennedict Lorenzo Avatar answered Oct 02 '22 20:10

John Bennedict Lorenzo


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.)
  • rebase will stop at that commit, 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)
like image 20
Vasfed Avatar answered Oct 02 '22 21:10

Vasfed