0

I get the following error:

remote: error: File AllFiles/Test.zip is 130.15 MB; this exceeds GitHub's file size limit of 100.00 MB

The thing is that I have removed this folder long time ago, and then used "git add ." as well as "git add --all" before committing - still git is convinced that this "large" file is in the folder and does not let me push to master...what can I do?

Pugl
  • 432
  • 2
  • 5
  • 22

2 Answers2

1

What you need to understand why this is failing and why the duplicate that phd linked is a duplicate, is to realize that git push does not push files. What git push pushes are commits. Commits contain files—each commit is a complete snapshot of all files—so this means that at least one of the commits you are pushing has the large file. When you go to remove the file from the current commit, it's not there, so that means that at least one of the commits you are pushing doesn't have the file. This is not self contradictory: you are pushing at least two commits, and at least one has the big file, while the last one does not have the big file.

Since git push pushes commits (and files just come along for the ride), you must change which commits you push. You do this by replacing your previous history—your previous series of commits that you added—with a new, different history: a new, different series of commits you have added. There are many ways to do that.

To see which commits git push will push, run git fetch first (so that your repository has all the commits that the upstream repository has), then run git log HEAD@{upstream}..HEAD.

torek
  • 448,244
  • 59
  • 642
  • 775
0

As stated, add this file to your .gitignore. Then you gotta remove the file from your cache, then you can git add . and then git push.

    git rm -r --cached .
    git add .
    git commit -m "Your commit message."
    git push
  • Did that, but guess what it says:fatal: pathspec 'Test.zip' did not match any files – Pugl May 02 '18 at 19:36
  • try *.zip unless you have other zip files you need. –  May 02 '18 at 19:38
  • It ignores two other files, but no word of "Test.zip" (which it is still finding though when I try to push): git rm -r --cached *.zip rm 'AllFiles/Archive.zip' rm 'AllFiles/ver-4b.zip' – Pugl May 02 '18 at 19:39
  • Last thing I know to try is "git rm -r --cached ." the dot with remove all cached files and then "git add ." will build a fresh cache. –  May 02 '18 at 19:40
  • same same:/..... – Pugl May 02 '18 at 19:58
  • When you run git status, does the zip file show up (in green)? (Im assuming you're using command line. –  May 02 '18 at 20:00
  • This is when I check the status the output: On branch master nothing to commit, working directory clean – Pugl May 02 '18 at 20:01