0

I tried to publish a file which was over 100MB

I then looked it up and realised GitHub has a limit.

Whilst it looks like I can make changes to use larger file Git lfs - "this exceeds GitHub's file size limit of 100.00 MB" that's not my goal. Instead, I edited the file and it's now under around 80MB

The issue is, when I try to git pull (or sync using the web application) I still get told this file is too big...

I can only guess git has got a handle to something which no longer exists but I have no idea how to remove it from attempted to upload this file.

This is my effort which also shows the failure (the first line). This is copied from the Git Shell

remote: error: File Photoshop/Originals/homePage.psd is 119.97 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/company/site.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/company/site.git'
G:\websites\GitHub\site\Website\site[master ↑3 +0 ~1 -0 !]> git rm --cached Photoshop/Originals/homePage.psd
fatal: pathspec 'Photoshop/Originals/homePage.psd' did not match any files
G:\websites\GitHub\site\Website\site [master ↑3 +0 ~1 -0 !]> git rm Photoshop/Originals/homePage.psd
fatal: pathspec 'Photoshop/Originals/homePage.psd' did not match any files
G:\websites\GitHub\site\Website\site [master ↑3 +0 ~1 -0 !]>
MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120
  • Perhaps the file is still somehow part of the repository. Just removing it from one commit doesn't mean that it still isn't present in earlier commits. Filter branch might be helpful here. – Tim Biegeleisen Jun 03 '17 at 12:32
  • `git filter-branch` just returns `Cannot rewrite branches: you have unstaged changes` – MyDaftQuestions Jun 03 '17 at 14:20
  • Don't blindly just run filter-branch. Figure out what is going on with that file and then go from there. Not my downvote. – Tim Biegeleisen Jun 03 '17 at 14:24

1 Answers1

1

Try and use BFG Repo-Cleaner, but make sure your current working tree has no change in progress (add and commit first)

cd /path/to/your/local/repo
java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive

Then push the new history (force push to overwrite: make sure you are the only one working on that repo, or do communicate your rewrite)

git push --force
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I first see: `Scanning packfile for large blobs: 702. Scanning packfile for large blobs completed in 397 ms. Warning : no large blobs matching criteria found in packfiles - does the repo need to be packed?` – MyDaftQuestions Jun 04 '17 at 12:15
  • When I run the line start `git reflog expire` I get this error: `The token '&&' is not a valid statement separator in this version` – MyDaftQuestions Jun 04 '17 at 12:16
  • @MyDaftQuestions this is a syntax for a bash session. If you run it on Windows, you can type bash first. – VonC Jun 04 '17 at 15:34
  • @MyDaftQuestions "no large blobs matching criteria": so you did not commit that large file before. – VonC Jun 04 '17 at 15:36
  • I don't think I commited. I believe I tried to and that is when I got this error message! And now every time I try to sync (GitHub Windows Desktop app) it fails. Which is why I moved to using `git pull` – MyDaftQuestions Jun 04 '17 at 16:27
  • @MyDaftQuestions Then can you try and add your file in a fresh clone of your repo (cloned in a different local folder) – VonC Jun 04 '17 at 16:28