Hi, Atlassian team.
I need to run git gc on the remote repository on bitbucket. What should I do?
The repo size on my local is just less than 100 MB but it is 2.8GB on the bitbucket.
How can I fix it? Thank you.
Best,
Kai
Hi Kai and welcome to the community!
I ran a git gc on your repo and its size has been reduced but not by a lot. Its size is 2.2 GB now.
Could you please let me know the following:
1. Did you rewrite history to remove large files from the repo?
2. Can you please take a mirror clone of the repo and then check the size of that?
You can get a mirror clone with the command
git clone --mirror <repo-url>
Then, navigate to the directory of the mirror clone and run the command
git count-objects -Hv
What output do you get from the last command?
A mirror clone is a bare repo with no working directory and with all the remote branches and it would be useful to get the size of that with the command I provided, to understand if large files still exist on your remote repo's history or if the difference in size is due to another reason (e.g. large files still referenced by PRs).
Just a heads up, I removed the repo details from your answer to protect your privacy.
Kind regards,
Theodora
1. Yes, I tried to rewrite the history to remove large files.
We used to have large ml models and datasets commited in the repo which caused this size bloat. This has been completely removed from the repo though and now the models and datasets sit in aws s3.
Also, I tried to git push --force to master branch expecting any decresement of the repo size, but nothing happend.
2. I cloned the git repository using --mirror flag and run the git count-objects -Hv command. The result is this.
count: 0
size: 0 bytes
in-pack: 20963
packs: 1
size-pack: 16.76 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kai,
Thank you for the details.
In this case, I think the most likely reason for the difference in size is that the large files you have cleared may still be referenced in certain Pull Requests of the repo.
If that is the case, then the only way to reduce the repo size would be by deleting these PRs. Is this something you would consider?
If so, I can create a support ticket on your behalf. One of my colleagues can look into it and confirm if it's indeed the PR refs contributing to the repo size, and share with you which PRs they are, so you can make a decision. We will only delete PRs with your consent.
Please feel free to let me know if you'd like me to create a support ticket for this.
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.
Hi, Theodora.
Thank you so much for clarifying everything. Yes, I agree with your opinion.
You can create a support ticket on my behalf. And then your colleagues can let me know which PRs is in large size. Once I make a decision, then you can delete those PRs.
Best regards,
Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kai,
Of course. I created the support ticket on your behalf using the email address of you community account.
You should have received an email with a link to the support ticket, and you can also see the ticket here after logging in:
I added an internal note for my colleagues where I explained what we discussed and also that the git gc was run for the repo. One of them will look into it and reach out to you via the support ticket.
Please feel free to let me know if you have any questions!
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.
Please execute Git GC on this repository
workspace - <redacted>
repository - <redacted>
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.