Hi ,
I recently performed a cleanup on one of our repositories, but the repository size displayed in Bitbucket has not updated accordingly.
Below are the commands I executed:
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push origin --force --all
git push origin --force --tags
When I run "git count-objects -vH" locally, I can see that the repository size has been reduced.
Could you please advise whether there's a delay in size recalculation on Bitbucket's side, or if any additional steps are required on my end?
Thank you.
I have attempted to reduce the size of your largest repositories by executing a garbage collection, but it has not reduced the size. This is because you have large binary files that are being retained in metadata storage (pull requests), and these are not present in a local clone. Unfortunately - metadata cannot be targeted with garbage collection operations and this is why we cannot reduce the size on our end.
To resolve this:
Perform a clone of those repositories for backup purposes
Delete those repositories from your workspace to free up space and allow you to push. NOTE: This will permanently remove metadata such as PR's/pipelines/user permissions etc.
Identify the largest files in your repositories by executing the following command:
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \| awk '/^blob/ {print substr($0,6)}' \
| sort -r --numeric-sort --key=2 \
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
Perform cleanup operations locally to reduce the size
Once complete, push those repositories back to your workspace by creating a blank repository with the same name of the deleted repository, then mirror pushing the contents of the cleaned repository:
HTTPS
git push --mirror https://<username>@bitbucket.org/<WorkspaceID>/<RepoName>.git
SSH
git push --mirror git@bitbucket.org:<WorkspaceID>/<RepoName>.git
NOTE: This will remove metadata such as PR's/pipelines/permissions etc but will keep your commit history and binary files intact.
Please let me know if you need assistance with this.
Cheers!
- Ben (Bitbucket Cloud Support)
Hi @Ben , thank you so much for your explanation and the detailed steps to resolve the issue. I will try it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey!
If you’ve done some cleanup (like history edits, rebases, squashes, or other history modifications) and pushed it, then the remote repo should now be as clean as the local one.
Unfortunately, the reflog and gc commands are local operations and aren’t transferred when pushing to a remote. Bitbucket has its own garbage collection system, which runs periodically or based on repository size.
So, one option is to wait for an Atlassian team member here on the forums to notice the issue and trigger a GC on your repo—or simply wait it out.
This has been a recurring issue on Bitbucket and has been resolved by the Atlassian team in the past.
Hope that clear things up!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.