1

I accidentally pushed large files to my git repository. Git complained that:

remote: error: GH001: Large files detected. You may want to try Git Large File Storage error: failed to push some refs to ...

After this, I tried to add those files to git ignore. I clearly saw that the status of those files that were too large changed to deleted.

However, after committing .gitignore and pushing again, I am surprised that git is still trying to push to the repository the large file I mistakenly pushed to the repo.

I tried git push -f origin HEAD^:master but nothing still worked. Git is still attempting to push the large file and I keep getting the same errors above.

Even after reverting my repo to a previous commit (before I had committed the large file), when I push, git is still pushing that large file.

Can anyone help me resolve my issue?

Thanks!

user1237300
  • 231
  • 2
  • 11
  • You need to revert to a commit in which you didn't yet commit these large files and __then__ add them to .gitignore. – Sergio Tulentsev Dec 06 '18 at 20:02
  • When you say you reverting to a previous commit, what **exactly** did you do? – Lasse V. Karlsen Dec 06 '18 at 20:03
  • I did revert to a commit when I didn't commit these large files. That's what I meant by revert to a previous commit – user1237300 Dec 06 '18 at 20:06
  • Don't use revert to remove large files from the history. Revert creates new commits that undo previous ones, but the previous ones and their associated files are still in the history. Use reset to remove commits. – nixlarfs Dec 07 '18 at 17:53

0 Answers0