Hello Bitbucket Community,
I am encountering a persistent issue with my repository identified as exceeding the 4GB size limit, despite local cleanup operations. After using BFG Repo-Cleaner and Git's garbage collection on my local system, my repository size has been significantly reduced. However, when attempting to force push these changes to Bitbucket, the push is declined due to the repository still being over the size limit.
My repository's URL is: https://bitbucket.org/<redacted>/<redacted>.git
.
The exact commands I have used are as follows:
git clone --mirror https://bitbucket.org/<redacted>/<redacted>.git
java -jar /path/to/bfg.jar --delete-files *.apk
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push --force
The error message I receive when trying to push is as follows:
remote: Repository is over the size limit (4 GB) and will not accept further additions.
To https://bitbucket.org/<redacted>/<redacted>.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://bitbucket.org/<redacted>/<redacted>.git'
Given that my local repository size is well below 4GB following the cleanup, I believe there might be a discrepancy in how Bitbucket is calculating the repository's size. Any help on how to rectify this would be greatly appreciated. Thank you in advance for your assistance!
Hello @Guy and welcome to the Community!
After pushing the cleaned-up repository to Bitbucket, the removed objects become dangling in the repository and a git garbage collection (GC) needs to be executed in the remote repository to remove those objects that are still occupying space.
I went ahead and triggered a GC on the repository you shared, and the size went down to 772MB!
Now that GC is completed, I would highly recommend you having everyone on your team removing their old copies of the repository and doing a fresh clone of it. Since the old clones have a dirty history, it's better to delete them, so you don't risk pushing the dangling objects back into your cleaned repository, which would increase its size again.
Note: I've removed the repository and workspace name from your question to protect your privacy.
Thank you, @Guy !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.