What's a simple way to find the size of my Git repository?
And I don't mean du -h
on the root directory of my repository. I have a lot of ignored files, so that size would be different from my total repository size. I essentially want to know how much data would be transferred upon cloning my repository.
To find the size of your . git directory, use du – sh . git. You can use git count-objects -v to count the number of unpacked object files and disk space consumed by them.
In Bitbucket Cloud, a repository admin can see the size under "Repository Details" under Settings. In Bitbucket Server too, you can view it under Settings > Repository Details after clicking on "Retrieve Size Details".
Maximum file size is 100MB Each file size will be limited to 100MB. If the file size exceeds the limit, you will receive an error message and the push will be blocked.
Note that, since git 1.8.3 (April, 22d 2013):
"
git count-objects
" learned "--human-readable
" aka "-H
" option to show various large numbers inKi
/Mi
/GiB
scaled as necessary.
That could be combined with the -v
option mentioned by Jack Morrison in his answer.
git gc git count-objects -vH
(git gc
is important, as mentioned by A-B-B's answer)
Plus (still git 1.8.3), the output is more complete:
"
git count-objects -v
" learned to report leftover temporary packfiles and other garbage in the object store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With