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.


Solution 1:

Known limits

There are multiple repo size limits which apply.

Soft limit

As of 2022, 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 2022, 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. Alternatively, the git-sizer tool can estimate the repo size locally.

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 or to 5 KB as per the soft limit of 5 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.

Solution 2:

From GitHub's 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.

and

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

Now for the non-canned part of my answer. GitHub might allow you to store files up to 100MB, but you should also be vigilant to not version binary or other similar blob type files. The reason for this is that Git doesn't handle binaries well, and storage can be a big penalty. So if you find yourself pushing 100MB per file, you should check what type of file you are dealing with.