Repository size limits for GitHub.com

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.


According to the 2019 version of this page (archive) and https://help.github.com/articles/working-with-large-files/ there is not limit on the repo size, but after exceeding 1 GB they might email you and ask to reduce the size:

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.

Additionally you will see warnings for pushing files bigger than 50 MB and files bigger than 100 MB won't be accepted.


File and repository size limitations

To ensure good performance for our users, we recommend repositories be kept under 1GB each. Keeping repositories small ensures that our servers are fast and downloads are quick. If your repository does exceed 1GB, you might receive an email from GitHub Support asking you to reduce it.

Repositories have a hard size limit of 100GB. If you reach 75GB, you'll receive a warning from Git in your terminal the next time you push a change. In addition, we place a strict maximum size limit of 100 MB for individual files in a repository

Source: 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


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.