GitHub.com 的存储库大小限制

Repository size limits for GitHub.com

最近我一直在使用 GitHub,我想知道 github.com 上托管的文件的存储库大小限制是多少?我一直在想这个,因为我正在考虑使用 GitLab,因为它允许每个存储库有 10 GB。

根据本页的 2019 版本(archive) and https://help.github.com/articles/working-with-large-files/ 回购大小没有限制,但超过 1 GB 后,他们可能会向您发送电子邮件并要求减小大小:

We recommend repositories be kept under 1GB each. This limit is easy to stay within if large files are kept out of the repository. If your repository exceeds 1GB, you might receive a polite email from GitHub Support requesting that you reduce the size of the repository to bring it back down.

此外,您将看到有关推送大于 50 MB 的文件的警告,并且不接受大于 100 MB 的文件。

来自Git中心的documentation

GitHub doesn't have any set disk quotas. We try to provide abundant storage for all Git repositories, within reason. Keeping repositories small ensures that our servers are fast and downloads are quick for our users.

In addition, we place a strict limit of files exceeding 100 MB in size.

现在是我回答的非固定部分。 GitHub 可能允许您存储最大 100MB 的文件,但您也应该警惕 不是 版本的二进制文件或其他类似的 blob 类型文件。原因是 Git 不能很好地处理二进制文件,存储可能是一个很大的损失。因此,如果您发现自己将每个文件推送 100MB,则应检查您正在处理的文件类型。

已知限制

有多个适用的回购大小限制。

软限制

截至 2022 年,根据 docs,这是 5 GB。如果您超过此限制,您可能会收到来自 GitHub 支持人员的电子邮件。

We recommend repositories remain small, ideally less than 1 GB, and less than 5 GB is strongly recommended.

如果您碰巧收到一封来自 GitHub 支持一个或多个 public 存储库的限制电子邮件,请将其报告为对此答案的评论以及 link回购协议,包括它周围的环境。

git push 警告限制

截至 2020 年,archived docs (backup) 摘录如下。可以合理地假设这仍然适用。这个限制显然可以忽略。

If you reach 75GB, you'll receive a warning from Git in your terminal the next time you push a change.

此外,对于每个超过 50MB 但低于硬限制的文件,您都会在终端中收到警告。

硬限制

截至 2022 年,虽然 docs 没有说明每个存储库的硬限制,但可以合理地假设之前记录的 每个存储库的硬限制为 100 GB 仍然适用,至少在收到来自 GitHub 支持的任何理论上的电子邮件之前。也摘录在下面的文档仅说明 每个文件 100 MB.

的硬限制

Individual files in a repository are strictly limited to a 100 MB maximum size limit.

截至 2020 年,下面摘录的 archived docs 指出 每个存储库的硬限制为 100 GB 。同样,可以合理地假设这个硬限制仍然适用。

Repositories have a hard size limit of 100GB.

截至 2018 年,documented (archive link) push size limit is 2 GB, although related considerations 也申请大量推送。

we don’t allow pushes over 2GB

文件也可以在版本中作为二进制文件共享。截至 2020 年,documented 每个此类文件的大小限制为 2 GB。

We don't limit the total size of the binary files in the release or the bandwidth used to deliver them. However, each individual file must be smaller than 2 GB.

搜索注意事项

如果想使用 GitHub 搜索 API,请注意所有其他适用的 considerations

检查使用的尺寸

您直接拥有管理员权限但不通过团队访问的每个回购的大小显示在 https://github.com/settings/repositories. Alternatively, the git-sizer 工具可以在本地估算回购大小。

绕过文件大小限制

如果它适用于您的应用程序,可以使用 tar 等工具 split a large file 分成 90 MB 的部分。

我建议不要使用 GitHub 强加的免费计划的 Git LFS due to the meager limits

文件数量

存储库中的最大文件数没有确定的限制。 A post from 2015 notes having 1.7 million files in a GitHub repo. Note that having 1 million files would restrict each file to a maximum average of 100 KB as per the presumed hard limit of 100 GB or to 5 KB 根据 5 GB 的软限制。

怎么写

为了能够使用 git 成功推送大量字节,您很可能首先必须 达到足够大的值,并具有足够的可用系统内存可用。

除了使用 git 之外,另一种以编程方式写入更新不多的文件的方法是使用 v3 REST or the v4 GraphQL APIs using a personal access token。这样做时,请确保不超过用户特定的每小时速率限制。与 git 不同,此 API 似乎不允许提交增量或差异。

加密

使用 git 时可以加密 the entire repo or just some files 的内容,但有几个注意事项。

比较

就其价值而言,GitLab(不是 GitHub)的最大回购大小限制为 10 GB since 2015. Moreover, GitLab (like GitHub) also seems to accept files of nearly 100 MB in size. If feasible, I would personally push to both GitHub 和 GitLab,提供隐式备份。

文件和存储库大小限制

为确保我们的用户获得良好的性能,我们建议每个存储库保持在 1GB 以下。保持存储库较小可确保我们的服务器速度快且下载速度快。如果您的存储库确实超过 1GB,您可能会收到一封来自 GitHub 支持的电子邮件,要求您减少它。

存储库的大小硬限制为 100GB。如果达到 75GB,下次推送更改时,您将在终端中收到来自 Git 的警告。此外,我们对存储库中的单个文件设置了 100 MB 的严格最大大小限制

来源:Github -> what-is-my-disk-quota

Note: If you add a file to a repository via a browser, the file can be no larger than 25 MB. For more information

限制增加了。 这是每个文件 500Mb。 存储库大小没有限制。 无限的存储库。 这些限制仅适用于免费帐户。 如果你支付限额真的增加了。

对于此类服务,每月 4 欧元并不算多,您可能会在在线流媒体上花费更多 ;-)。

无论如何,如果 github 适合你的项目,你不应该太在意限制,github 的真正目的,即使微软收购它是为了获得你的源代码。 无论您怎么想,它们确实为团队和开源代码提供了有趣的工具。对于真正需要安全性的公司,我会非常关心在“其他计算机”上托管文件。