Hello!
I ran BFG Repo cleaner, following the directions here. This successfully reduced the size of my repository (based on fresh `git clone` and `git clone --mirror`) by several hundred megabytes. However, the Bitbucket workspace and Bitbucket Repository size has not decreased, even after several more pushes and waiting for 30 days.
I see other forum posts here that Bitbucket Support can run garbage collection on their end to reduce the size of my repository. Could somebody please help with that? My workspace is https://bitbucket.org/Dumpis/, and the repository is named custom-hobo.
Thank you!
Hi Peter,
Thanks for the response! Appreciate your time.
I tried suggestions 1 and 2. For anyone else reading this, make sure you have a backup repo and make sure you make a dummy commit on master before running git reset --hard HEAD~1 and git push --force. Otherwise, you will delete your most recent commit, potentially losing valuable work.
Unfortunately, creating dangling commits, even after git reflog expire --expire=now --all && git gc --prune=now --aggressive and a push, did not affect my repo size. It is still several hundred megabytes larger on the Repository Details page than a fresh clone is.
It's possible that old pull requests are holding onto blobs, but it looks like BFG did a good job at cleaning the relevant commits out. Seems odd to me that a pull request with no associated commits could keep blobs alive. For example, one pull request has zero commits since I cleaned the one that added some big files.
Deleting all of my pull requests (even if I have a CSV backup) is a very undesirable solution. I need my pull requests to exist in BitBucket, as they have valuable historical information in them that my team relies on.
Two more follow up questions:
- my repository is bumping up the 1GB free-tier limit, not 2GB. Is it possible that since we're not at 2GB yet the cleanup is refusing to run?
- is there any way for me to identify which specific PRs need to be deleted, assuming it is a PR that is preventing necessary cleanup from happening?
Thanks again for the help.
Hi @Tom Wiseman
As you're on a free plan, the maximum workspace size limit is 1GB. This was announced at the beginning of the year and was implemented in May: https://www.atlassian.com/blog/bitbucket/important-changes-coming-to-bitbucket-clouds-free-plan
The cleanup may refuse to run if performing the force push may push you over the 1GB limit temporarily whilst the automated gc process is yet to occur. Unfortunately, deleting at least some PR's is mandatory to reduce the size as these store refs in an effort to speed up PR diff calculation.
For further support, we'll need to raise a ticket on your behalf. May I know what timezone you're in so I can raise one with the appropriate team who operate in your region?
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tom Wiseman ,
Unfortunately, Bitbucket doesn't auto-garbage-collect dangling objects immediately after history rewrites. The 30-day wait is for local reflog expiry, and pushes alone won't trigger it unless you're over the 2GB warning threshold. :)
But as a product admin, you can try self-triggering auto-GC first (no support ticket needed):
1. Force a Size-Triggering Push: In your cleaned mirror repo, run git reset --hard HEAD~1 (creates a dangling commit), then git push --force to main/master. This mimics an "undo last push," prompting Bitbucket to auto-run full GC (garbage collect) within minutes. Refer to this Git article / Reduce repo size.
2. Check Size: Refresh the repo settings—should drop to match your local clone. If not, run git reflog expire --expire=now --all && git gc --prune=now --aggressive locally, push again, and retry the reset/push.
3. PR Cleanup Check: If GC still skips, old pull requests might be holding refs to large blobs. Use this Python script (from Atlassian KB) to list recent PRs, close/delete them, then re-push. You can refer to this article.
If this doesn't work out, reach out to Bitbucket Support for a manual GC on custom-hobo. As admin, log in at support.atlassian.com/contact > Select Bitbucket Cloud > "Repository size/management" > Provide the workspace/repo URL and your BFG logs.
Hope everything works out for you.
Best,
Peter
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.