In our Stash production, we have a Repository System Info Plugin which shows the following information.

- Repository location on disk

- The size of the repository

- The installed SCM hooks

However, the size of the repository shown in Stash and the size of the cloned repository appears to be different even after deleting the .git folder.

Why is it so ? Am I doing anything wrong ?

My understanding is that cloned repo size should be same as what is shown in the Stash through Repository System Info Plug-in.

Please advise. Thanks

2 answers

1 accepted

0 votes
Accepted answer

The repo size that's reported by the Repository System Info Plug-in is the size of bare repository on the server (comparable to the .git directory of a regular git repository). Bare repositories don't contain a working tree and will therefore be smaller than a 'normal' git repository.

Your clone will be a normal git repository and should therefore be bigger than the size reported by the plugin.

That makes sense, but we are seeing the size as reported by the Stash repository settings differ wildly even from the .git folder of a cloned repo. We are trying to find a way to calculate how much space the repo is actually going to take up when cloned so our scripts can ensure the box has enough disk space before cloning.

The .git folder of a non-bare clone contains some additional stuff to the bare repo. (some objects are uncompressed, local branches can be present, etc.).

The ratio between the bare repo size and the non-bare clones can further vary quite much depending on e.g. the amount of binary (badly compressible) files, amount of history, etc.

I think your best option is to clone (at least some of) your repositories to somebody's computer to estimate this ratio and use [bare size]*[ratio+some margin] as the threshold in your scripts.

I will do as you suggest. I'm curious, though. Even the size of a repo cloned using

git clone --bare

seems to differ in size from the size reported by Stash by a factor of about 2.

That is interesting. Which one is bigger? (I have no idea why, other that some objects might be unpacked in one and packed in the other.)

I would expect the repository in Stash to be bigger. It will have more unpacked objects. Also, some objects may still be referenced by Stash's pull request refs, which don't get fetched by default when you clone a repository (they're outside the default ref spec). Therefore, you'll retrieve less objects and would get a smaller repository when you create a _bare_ clone.

The bare clone is consistently bigger. I've collected data on 9 different repos, and the size of the bare cloned repo varies from 1.0 (meaning, obviously, it was about the same for that repo) to 1.9 x the size reported by Stash. My mean result was 1.3 with a stdev of 0.3. This data was gathered immediately after performing the --bare clone. Not really an issue for me since what I really needed to be able to do was to estimate how much space the non-bare clone will take up, so I'm following Balazs's suggestion and just multiplying by a scaling factor (I'm using 15, because the highest ratio I found was 12.3).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

445 views 6 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you