Dear BitBucket Support Team,
I recently received a notification stating that “Your workspace is over 1 GB – please take action now.”. I'm currently reviewing the projects under my account and noticed something that I'd like to clarify with your help.
In particular, the repository `<redacted>` is reported in the Bitbucket UI to be using 959.77 MB. However, when I clone this repository locally, it takes up significantly less space - around 444 MB, as shown by the `du -sm` command, and 465.1 MB on disk according to Finder’s “Get Info”.
Here are the commands I ran to verify this:
>git clone <repo_url>
Cloning into 'repo-name'...
remote: Enumerating objects: 71533, done.
remote: Counting objects: 100% (6396/6396), done.
remote: Compressing objects: 100% (4641/4641), done.
remote: Total 71533 (delta 5161), reused 2015 (delta 1751), pack-reused 65137 (from 1)
Receiving objects: 100% (71533/71533), 317.85 MiB | 6.89 MiB/s, done.
Resolving deltas: 100% (50734/50734), done.
>du -sm repo-name
444 repo-name
Could you help me understand:
1. Why the repository size shown in BitBucket is significantly larger than the actual local clone?
2. Is this due to Git history, pack files, or something else stored in the remote?
3. Are there any recommended steps I can take to reduce the size of this repository on BitBucket’s side?
Thank you for your time and support.
Best regards,
Yakiv
Hi Yakiv and welcome to the community!
I cannot access the contents of your remote repo, but I believe that there may be unreferenced objects in the remote (e.g. from deleted branches) that haven't been cleared or that the automated garbage collection didn't pack the objects very efficiently.
I triggered a git gc that should pack the repo more efficiently and the repo's size has been reduced to 308.9 MB.
Does it look ok now on your end?
Users cannot trigger a git gc on their remote repos, but you can can create a question in community if you would ever like us to run it for a certain repo of yours.
Please keep in mind that the steps you followed are not a very accurate way to verify differences in size and you will almost always get a different number, for the following reasons:
What you can do is:
1. Take a mirror clone of the repo with the command
git clone --mirror <repo_url>
This will be a bare repo with all the history and no working directory.
2. Then, navigate to the directory of the mirror clone and run the command
git count-objects -Hv
The sum of the fields size and size-pack in the output will show you the repo's size and you can use that to compare with the size displayed in Bitbucket.
Just a heads up, I removed the repo details from your post to protect your privacy.
Please feel free to reach out if you have any questions!
Kind regards,
Theodora
Hi Theodora,
Thank you so much for your help!
I really appreciate you running the `git gc` - the repo size looks much better now on my end. Your explanation about why my method for checking the size wasn't accurate was very helpful and clarified a lot for me.
Also, thanks for taking the extra step to remove the repo details from my post to protect my privacy. That was very thoughtful.
Really appreciate your support!
Best regards,
Yakiv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome, Yakiv! I'm glad to have helped.
Please feel free to reach out if you ever need anything else!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.