Hi Community.
We area problem with a repository. We have a message that our repository is used the 1.8 GB.
Although in bitbucket reports that the repository is using 1.8 GB when running the command "git count-objects -vH" shows that the size is 24.27MB, as below:
count: 0
size: 0 bytes
in-pack: 2719
packs: 1
size-pack: 24.27 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes
With the command below it was possible to discover 95 files that are the binary we want to clean. Each has approximately 25MB.
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
After that, I found out that my problem is binary and that even binary is not indicated in repositories so I decided to delete his history to free up space.
Following some tutorials, I reached the BFG tool and performed the following instructions:
bfg --delete-files BINARY
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push --all
After executing the push successfully, I searched for the binary files and the 95 no longer existed, that is, the cleaning worked.
However, in the bitbucket repository the space has not reduced, continuing to use 1.8GB and also if I "git pull" it returns all files as it was before.
Does anyone have any idea what I can do?
Hello @Alam Luiz Colatto,
As the guide suggests, after you reduce the size of a repository, you need to contact Bitbucket Support team to force garbage collection for that repository. GC is triggered automatically from time to time, but not on every push since it is an expensive operation. So eventually it'd be triggered by Git itself given that your repository is still under the 2GB limit. Support team would just speed that up.
You didn't mention what is the repository you're trying to reduce in size, so I took a blind guess based on the size and last access date and triggered GC on our side. The repo reduced to 28 MB.
Hope this helps. Let me know if you have any questions.
Cheers,
Daniil
Hi Daniil
It worked.
Many thanks for your help.
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.