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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 10, 2018 in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

241 views 14 2
Join discussion

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