Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
626 views
in Technique[技术] by (71.8m points)

git - Repository size limits for GitHub.com

Lately I have been using GitHub and I'm wondering, what is the repository limit for files hosted on github.com? I've been wondering this because I was thinking of using GitLab since it allows 10 GB for each repository.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Known limits

There are multiple repo size limits which apply.

Soft limit

As of 2021, as per the docs, this is 5 GB. If you exceed this limit, is possible that you will receive an email from GitHub Support.

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

If you do happen to receive a restricting email from GitHub Support for one or more public repos, please report it as a comment to this answer along with a link to the repos, including the circumstances surrounding it.

git push warning limits

As of 2020, the archived docs (backup) excerpted below stated the following. It is reasonably assumed that this still applies. This limit can obviously be ignored.

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

Also, you'll receive a warning in the terminal for each file of over 50MB but under the hard limit.

Hard limits

As of 2021, although the docs don't state the per repository hard limit, it is reasonably assumed that the previously documented per repository hard limit of 100 GB still applies, at least until any theoretical email from GitHub Support is received. The docs, also excerpted below, state only the per file hard limit of 100 MB.

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

As of 2020, the archived docs excerpted below stated that the hard limit is 100 GB per repository. Again, it is reasonably assumed that this hard limit still applies.

Repositories have a hard size limit of 100GB.

As of 2018, the documented (archive link) push size limit is 2 GB, although related considerations also apply for large pushes.

we don’t allow pushes over 2GB

Files can also be shared as binaries in a release. As of 2020, the documented size limit of each such file is 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.

Search considerations

If wanting to use the GitHub Search API, be aware of all the additional considerations that apply.

Checking used size

The size of each repo to which you directly have Admin access, but not via a team, is shown at https://github.com/settings/repositories.

Bypassing file size limit

If it works for your application, a tool such as tar can be used to split a large file into 90 MB parts.

I advise against using Git LFS due to the meager limits of its free plan as imposed by GitHub.

Number of files

There is no established limit of the max number of files in a repo. 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).

How to write

To be able to successfully push a large number of bytes using git, it is highly likely that you'll first have to configure http.postBuffer to a sufficiently large value, with enough free system memory available.

Apart from using git, the other way to programmatically write files that are not updated much is to use the v3 REST or the v4 GraphQL APIs using a personal access token. When doing so, ensure that the user-specific hourly rate limit is not exceeded. Unlike with git, this API doesn't however seem to allow submitting an increment or a diff.

Encryption

It is possible to encrypt the contents of the entire repo or just some files while using git, with several caveats.

Comparison

For what it's worth, GitLab (not GitHub) has had a max repo size limit of 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 and GitLab, providing an implicit backup.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...