Reputation: 517
I accidentally push a large file to a remote git reposiroy in Bitbucket.
The file has .webm
extension.
I put *.webm
in .gitignore
, and then in order to delete it I ran BFG:
java -jar bfg-1.13.0.jar --delete-files *.webm
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push origin --force
The problem is that the last command keeps pushing the original .webm file to the remote repository and bitbucket keeps saying that my repository has reach 1Gb+ of used space.
If I run instead of the last command git push -u origin master
, it says that I need to do a git pull
, which makes me download again the large file.
What am I doing wrong? Should I delete the file directly from Bitbucket?
Upvotes: 0
Views: 336
Reputation: 51780
See the "Your files are sacred" paragraph of the BFG docs :
By default the BFG doesn't modify the contents of your latest commit on your master (or 'HEAD') branch, even though it will clean all the commits before it.
That's because your latest commit is likely to be the one that you deploy to production
(...)
If you want to turn off the protection (in general, not recommended) you can use the
--no-blob-protection
flag:$ bfg --strip-biggest-blobs 100 --no-blob-protection repo.git
Another way is to manually remove it from the head commit :
git rm --cached thatfile.webm
git commit --amend
Upvotes: 3