在克隆之前如何查看 GitHub 存储库的大小? [英] How can I see the size of a GitHub repository before cloning it?

查看:25
本文介绍了在克隆之前如何查看 GitHub 存储库的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在决定克隆之前,有没有办法查看 GitHub 上的 Git 存储库有多大?

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

这似乎是一个非常明显/基本的统计数据,但我在 GitHub 上根本找不到如何查看它.

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

推荐答案

有一种方法可以通过 GitHub API.

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

在检索有关存储库的信息时,名为 size 的属性的值是整个存储库的大小(包括其所有历史记录),以千字节为单位.

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.

例如,Git 存储库的权重约为 124 MB.返回的 JSON 负载的 size 属性值为 124283.

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

大小确实是根据服务器端裸仓库的磁盘使用情况以千字节表示的.但是,为了避免在大型网络的存储库中浪费太多空间,GitHub 依赖于 Git 替代方案.在此配置中,针对裸存储库计算磁盘使用量不考虑共享对象存储,因此通过 API 调用返回不完整"值.

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.

此信息由 GitHub 支持提供.

This information has been given by GitHub support.

这篇关于在克隆之前如何查看 GitHub 存储库的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆