Sub topic 13
Usage limits and acceptable use
This chapter assumes you can already publish a site from a branch or a workflow, as covered earlier. It covers the documented limits that apply to a GitHub Pages site and the rules about what the service may be used for. These limits are rarely a problem for a personal site or documentation. They matter if your site grows, gets popular, or starts to look like a business application.
Documented limits
GitHub publishes these limits for Pages. Check the current GitHub documentation before you rely on exact numbers, because they can change.
| Limit | Value | Type |
|---|---|---|
| Published site size | 1 GB | Hard limit |
| Source repository size | 1 GB recommended | Recommendation |
| Bandwidth | 100 GB per month | Soft limit |
| Builds from a branch | 10 per hour | Soft limit |
| Deployment duration | 10 minutes before timeout | Hard limit |
A hard limit makes the deployment fail. A soft limit is a threshold GitHub may act on. If you go over a soft limit, you might get an email or a request to move assets to a content delivery network (CDN). A CDN is a service that caches your files on servers around the world. Your site might also be rate limited, which means some requests get an HTTP 429 response.
The build limit does not apply if you publish with a custom GitHub Actions workflow. The deployment timeout still applies.
Checking your site size
Before a large deployment, measure the folder you publish. This example assumes the site lives in a folder named site, as in the workflow from the earlier chapter.
du -sh site
find site -type f -size +20M -exec ls -lh {} \;The first command prints the total size of the folder. The second lists any file larger than 20 MB. Large videos, uncompressed images, and downloadable archives are the usual causes of an oversized site.
Git has its own limit as well. GitHub rejects any single file over 100 MB in a normal push. Pages does not raise that limit.
Reducing bandwidth
Most sites stay far below 100 GB a month. If yours gets close, these steps help:
- Compress images and use modern formats such as WebP.
- Host large media on a service built for it, and link to it from your pages.
- Put a CDN in front of the site, which serves repeat requests from its cache.
- Remove files nobody links to.
Acceptable use
GitHub Pages is meant for personal, organizational, and project pages. The documentation says it is not intended to be, and may not be used as, a free web hosting service for running an online business, an e-commerce site, or any other website primarily directed at facilitating commercial transactions or providing commercial software as a service (SaaS). A small donation link or a page for your open-source project is fine. A storefront with a checkout is not.
The documented prohibitions also include:
- Sensitive transactions. Don't ask visitors for passwords, credit card numbers, or similar data through your site.
- Illegal content, or anything that violates the GitHub Terms of Service.
- Abuse of the service, such as using it to attack other systems or to avoid its limits.
A static site can't process payments or store accounts by itself anyway, since it cannot run server-side code. The policy mostly matters when you embed third-party services that do those things for you.
Privacy of published content
Treat everything you publish as public. On many plans a Pages site is public even when its source repository is private, and private repositories can only publish Pages on paid plans. Organizations on GitHub Enterprise Cloud can restrict access to a site, but that is an exception. Never commit API keys, tokens, or personal data to the publishing branch or folder. Anything under it can be fetched by URL, and it stays in Git history after you delete it.
What to do when you hit a limit
- Deployment fails on size: find the large files with the command above and remove or externalize them.
- Deployment times out: reduce the number of files, or move generated content to a build step that outputs less.
- Build rate warnings on a branch source: batch your commits, or switch to a workflow, which isn't subject to the build limit.
- Bandwidth notice: add a CDN, or move heavy assets elsewhere.
- Policy notice: read the message, then remove the offending content or move the commercial part to a proper hosting platform.
Exercise
Your site publishes from a branch and gets a notice that it is over the monthly bandwidth limit. Is this a hard or soft limit, and what two changes could reduce the traffic Pages serves?
Show answer
The 100 GB per month bandwidth limit is a soft limit, so the site may keep working but GitHub can contact you or rate limit it. You can compress or remove large files such as images and video, and you can put a CDN in front of the site or host heavy media elsewhere.
Exercise
A teammate wants to add a shopping cart with a card payment form to the Pages site. Why does this conflict with the documentation, and what should they do instead?
Show answer
GitHub Pages may not be used primarily for commercial transactions or e-commerce, and sites should not collect sensitive data such as credit card numbers. They should host the store on a platform built for commerce, and the Pages site can link to it.