Hello,
We are about to migrate to Bitbucket from GitLab. In some preliminary tests, we noticed a large difference in repository storage size when importing a project to Bitbucket from GitLab (using Bitbucket's import functionality). As an example, a 640 MB repository becomes 192 MB on Bitbucket. Everything is imported correctly, and the history seems intact. This drastic size difference remains however a bit mysterious. We would like to make sure that really nothing is lost in the process.
I would be happy to understand more rigorously the reason of this change, and would gladly take any input / advice on how to debug this.
Best regards,
p.s. we are not using Git LFS
Hi @Michael Ligotino and welcome to the community!
When you import a repo, all the branches and history of the .git repo will be imported (the only exception is Git LFS objects, that you are not using).
One possible reason for this discrepancy may be inaccessible commits in the GitLab repo. If you do any of the following:
then certain commits will become inaccessible. These inaccessible commits remain in the remote repo unless a garbage collection runs (git gc). When a git gc runs for a repo, it can run with different parameters that determine which inaccessible objects will be deleted.
A git gc also compresses file revisions and there are parameters that control the depth of compression.
So, the size of the repo in GitLab depends on when the last garbage collection ran for that repo and with what arguments.
When you import a repo these unreachable objects will not be imported.
You can try taking a bare clone of the GitLab repo on your machine, with the command
git clone --bare <gitlab_repo_url>
Then navigate to the directory of the bare 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 size of the bare clone.
Kind regards,
Theodora
Dear Theodora,
Thank you so much for your answer. This will definitely help me understand more what is going on.
Kind regards,
Michael
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, Michael. 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.