Repository size limits for GitHub.com

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 Bitbucket, consider this answer. As feasible, I would personally push to both GitHub and Bitbucket, providing an implicit backup.

As of 2022, GitLab (not GitHub) looks to be lowering its free quota from 10 GB per repo to a total of just 5 GB for all repos combined! You can see the total space used in your GitLab account.

Leave a Comment