I have committed and pushed a too large file in bitbucket, and I've deleted it locally, committed and pushed again. But on the site bitbucket the size of the repository is still too large.
问题:
回答1:
Sounds like you created a new commit where you deleted the file. That means the file still exists in the previous commit.
What you need to do is rewriting history. Assuming the two newest commits are deleting and adding that file, you can do the following:
git reset --hard HEAD~2
git push --force
This will remove the two newest commits and then forcefully push it to bitbucket. In case that doesn't help reducing the site you need to contact bitbucket support so they can run git gc
on your remote repository to actually get rid of the deleted commits/files.
If you only want to remove the given file without nuking the whole commit, you can do it using git-filter-branch
as explained in the GitHub docs (it's not GH-specific):
git filter-branch --index-filter 'git rm --cached --ignore-unmatch THE_FILE' \
--prune-empty --tag-name-filter cat -- --all
Obviously you need to replace THE_FILE
with the name of the file you want to obliterate. After this you also need to perform a forced push.