Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

git repo size too big

Ralph Strebl March 22, 2025

Hello,

one of my repos got too big, almost 2.2 gb. I already did rewrite history locally and pushed it to one of my branches. I did also push with force option to origin repo. I locally reduced the size to 280 MB.

 

So now I need to run gc on remote repo. How could i reach that.

 

Thanks in advance

Kind regards

Ralph

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2025

Hi @Ralph Strebl and welcome to the community!

A git gc on the remote repo can be run manually only by the Bitbucket support team. If you are on the Free plan and can't create a support ticket, you can create a question here in community; we have Atlassian staff, myself included, checking community and we can help.

If you haven't deleted the original repo yet, I can run a git gc on it, so that you won't lose any PR history. If you push your cleaned repo to a new empty one, PR history and other metadata won't be transferred. I don't see any repos in your account with a size of 2.2 GB, but I do see one with a size of 1.7 GB. Please let me know if that's the one, and I can run a git gc on it if you want.

Kind regards,
Theodora

Ralph Strebl March 24, 2025

Hi Theodora,

thanks for your reply.

I did not delete the big sized repo yet. So if you can start the gc for this one would be very nice. The repo sized 1.7GB is the correct one.

I already reduced the local size to 230 mb now and pushed the changes to the oversized repo. So after your gc the bad commits should be deleted.

 

Please let me know when you have run the gc, so i can check the size again.

Thanks for your help

Kind regards

Ralph

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2025

Hi Ralph,

Of course. I ran a git gc for the repo, but its size has been reduced to only 1.1 GB.

Could you please take a mirror clone of the repo and check of that size? I am asking that so I can understand if the size we see now on Bitbucket is because of the core git repo, or, if there are PR refs that may still reference older objects you deleted with history rewrite.

You can take a mirror clone with the command

git clone --mirror <repo_url>

A mirror repo will get all branches of the remote repo locally and it will have no working directory.

You can then navigate to the directory of the mirror clone and run

git count-objects -Hv

What output do you get from this last command?

Kind regards,
Theodora

Ralph Strebl March 24, 2025

Hi Theodora,

 

I cloned the repo with option --mirror and get the following result:

count: 0
size: 0 bytes
in-pack: 17258
packs: 1
size-pack: 271.25 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes

 

The size I get is equal to the local size near by 270 MB. Seems like the repo has already the right size. Why then bitbucket is still counting 1.1 GB?

 

Kind regards,

Ralph

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 25, 2025

Hi Ralph,

Thank you for the info.

I believe the most likely reason is that the large files you removed from history may still be referenced in certain PRs of the repo, contributing to its size. If that's the case, the only way to reduce the repo's size would be by deleting these PRs after all.

I can't confirm if it's indeed PR refs contributing to the repo size because I can't access your repo without a support ticket. If you'd like, I can create a support ticket on your behalf, and one of my colleagues can look into it. If the culprit is indeed PR refs, they could give you a list of these PRs and ask you if you'd like them to be deleted (we won't delete anything without permission from you).

Please feel free to let me know if you'd like me to open the support ticket, or if you prefer to start with a new repo.

Kind regards,
Theodora

Ralph Strebl March 25, 2025

Hi Theodora,

ok, I see.

It would be great if you can create a ticket for this issue. If any affected PR number less than 25 (range 1 to 25), you can delete it anyway, for this you need no permission from me. I deleted the following files locally when I rewrite the history, maybe this helps you to find the affected PRs.

<redacted>

Thank you very much for your help, I appreciate that.

Kind regards,

Ralph

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 25, 2025

Thank you, Ralph.

I created a support ticket on your behalf using the email address of your community account. I added an internal summary for my colleagues, explaining what we have discussed and done so far and also providing the list of the deleted files (I removed them from your post for privacy).

You should have received an email with a link to the support ticket. You can also see the ticket here https://support.atlassian.com/requests/ after you log in with the email address of your community account. One of my colleagues will reach out via the support ticket.

Please feel free to let me know if you have any questions!

Kind regards,
Theodora

Ralph Strebl March 26, 2025

Hi Theodora,

 

thank you for your help. I received the list of PRs from your colleague. We found a solution and the problem is solved 😊

 

Thank you for your help and fantastic support. I appreciate that.

Wish you all the best

Kind regards,

Ralph

 

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2025

Hi Ralph,

Thank you for the update, it's good to hear that the problem is solved, and you are more than welcome.

Please feel free to reach out if you ever need anything else!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events