How to determine the size of a Git repository


Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

In this article, we will show you how to determine the size of a Git repository on commonly used platforms and a bare Git repository.

Please note that the size of a Git repository on your local machine may differ from the size displayed on platforms like GitHub, Bitbucket, and others. This variation occurs because these platforms often retain extra files or objects not present in a standard clone. Consequently, the size of your local repository copy is usually smaller than the size reported by these platforms.

The goal of this article is not to compare the various sizes of a Git repository but to provide an estimated size to help assess whether Bamboo Guardrails applies to your situation.

Environment

The solution has been validated in the following Git platforms:

  • Bitbucket Cloud

  • Bitbucket Data Center

  • GitHub

  • Git

Solution

Choose from one of the following options based on the Git platform you're working with:

Bitbucket Cloud

https://confluence.atlassian.com/bbkb/what-are-the-repository-and-file-size-limits-1167700604.html#Whataretherepositoryandfilesizelimits?-Findingyourrepositorysize

Bitbucket Data Center

https://hello.atlassian.net/wiki/spaces/~sorlovski/pages/edit-v2/4098894383#Bitbucket-Data-Center

GitHub

If you own the repository, you can find its exact size by opening Account SettingsRepositories (github.com/settings/repositories). The repository size is displayed next to its designation.

If you don't own the repository, follow the steps below in a local copy of the repository to determine its size.

Git

  • Run git count-objects -vH from the command line in a local copy of the repository.

  • Look for the entry called "size-pack".

myRepository % git count-objects -vH
count: 0
size: 0 bytes
in-pack: 2848693
packs: 1
size-pack: 1.18 GiB   <-- size of repository
prune-packable: 0
garbage: 0
size-garbage: 0 bytes




Last modified on Feb 18, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.