Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find size of Git repository

Tags:

git

filesize

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.

like image 490
mschallert Avatar asked Nov 18 '11 16:11

mschallert


People also ask

How do I find the size of a git 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.

How do I find the size of my Bitbucket repository?

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".

How big is a git file?

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.


1 Answers

Note that, since git 1.8.3 (April, 22d 2013):

"git count-objects" learned "--human-readable" aka "-H" option to show various large numbers in Ki/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.

like image 139
VonC Avatar answered Sep 28 '22 21:09

VonC