Forums

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

Yet another git gc request

Jonathan Duke March 27, 2025

I'd take care of this myself, but Bitbucket seems to have no way of doing so or of contacting support.

I've tried the trick of doing a commit and then resetting to HEAD~1 and doing a force push, but that doesn't work. I even tried pushing the size of my repo up over 3 GB, and then when I did that process, it finally seemed to have kicked in and dropped a little bit from 3.5 GB down to 2.9 GB, but that's still way too large.

On my local file system, with everything pruned and packed, the repo is under 5 MB:

count: 0
size: 0 bytes
in-pack: 13324
packs: 1
size-pack: 4.71 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes

But because some developer long ago accidentally committed a video file years ago before I was on this project, I can't get the repo size down, even though I've already modified the history to remove that commit retroactively.

It is ridiculous that there's not a button under the Repository Details tab to force a git gc! It doesn't even seem to be doing periodic garbage collection for maintenance, because I removed that file in July of 2023 when I first started contributing to this project.

Until we got the 1 GB warning email, it didn't even matter, but there's got to be a better way to handle that.

3 answers

1 accepted

0 votes
Answer accepted
Jonathan Duke April 8, 2025

@Mikael Sandberg or @Phil C,

Is there any way to get a follow up on why that repo is still so big? The only other thing I can think to try is deleting the repo and reuploading the clone from scratch.

Phil C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2025

Hi Jonathan,

Apologies for the delay!

I ran garbage collection again on the repository, and the size remains unchanged. Since you cloned the repository, the size is significantly smaller than what's reported remotely. I believe that object preservation, which maintains objects on the server side of pull requests and aids in calculating pull request diffs, might be causing the repository size to be inflated - (Improving performance on complex diffs).

Typically, a way to further reduce the size is to delete the pull requests that preserve objects in the repository. However, given the large number of pull requests, this option isn't ideal. As you suggested, an alternative would be to create a new empty remote repository with the same name and then push the contents of the local repository to it.

- Phil

Jonathan Duke April 11, 2025

@Phil C, that's it! I didn't even think about pull requests because we aren't using them now. Is there any way to wipe out all of the pull requests and then do the GC again? I can't find a way in the UI to delete them.

If not, I guess I'll just have to go with the delete repo option and push the clone back to a fresh one.

Phil C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2025

Hi Jonathan,

 

There are a lot of pull requests. Therefore deleting them is not ideal. It'll be quicker to clone the repository and push it to a fresh remote repository. 

- Phil 

0 votes
Phil C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2025

Hi Jonathan,

Welcome to the community!

I reviewed the repositories you have access to and found one that exceeds 1 GB in size.

I've run garbage collection on the repository, the repository size has decreased. Is the current size of the remote repository now comparable to the local repository size? To verify, you can execute the following command in the local repository:

You can check by running the following command on the local repository: 

git count-objects -vH 

The "size-pack" will display the local repository size.

Before making the next push to the remote repository, please ensure that you and all collaborators create a fresh clone of the remote repository to prevent reintroducing old or cleaned-up history, which could lead to increasing the repository size again.

- Phil

Jonathan Duke April 1, 2025

Thanks, Phil. I see that the size did decrease on Bitbucket, but it still shows that it is 684.54 MB via the web UI.

However, when I run count-objects on a fresh clone, it tells me it's 5.29 MiB:

count: 0
size: 0 bytes
in-pack: 13324
packs: 1
size-pack: 5.29 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes

 

Jonathan Duke April 4, 2025

@Phil C any follow-up to my reply?

0 votes
Mikael Sandberg
Community Champion
March 27, 2025

Hi @Jonathan Duke,

Welcome to Atlassian Community!

I have notified the Atlassian support team that is on here and they will reach out to you within 2 business days regarding this. 

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