Answer a question

Is there a way to see how big a Git repository is on GitHub before you decide to clone it?

This seems like a really obvious/basic statistic, but I can't find how to see it on GitHub at all.

Answers

There's a way to access this information through the GitHub API.

  • Syntax: GET /repos/:user/:repo
  • Example: https://api.github.com/repos/git/git

When retrieving information about a repository, a property named size is valued with the size of the whole repository (including all of its history), in kilobytes.

For instance, the Git repository weights around 124 MB. The size property of the returned JSON payload is valued to 124283.

Update

The size is indeed expressed in kilobytes based on the disk usage of the server-side bare repository. However, in order to avoid wasting too much space with repositories with a large network, GitHub relies on Git Alternates. In this configuration, calculating the disk usage against the bare repository doesn't account for the shared object store and thus returns an "incomplete" value through the API call.

This information has been given by GitHub support.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐