GitHub Pages HTTPS: Custom Domain Free SSL Guide
GitHub Pages gives every site a free certificate, so there is nothing to buy and nothing to install. Your job is to point DNS correctly and tick one box. When the certificate does not appear, the cause is almost always a DNS record that GitHub does not like. This guide follows the current GitHub Docs pages on securing Pages with HTTPS and on troubleshooting custom domains.
What GitHub does for you
According to GitHub, all Pages sites, including those with a custom domain, support HTTPS and HTTPS enforcement. Sites on github.io created after June 15, 2016 are served over HTTPS automatically. For a custom domain, GitHub runs a DNS check when you save the domain. If it passes, GitHub requests a certificate from Let's Encrypt and installs it on the servers that handle TLS for Pages.
Two limits from the docs are worth knowing. The full domain name must be shorter than 64 characters, because of the common name length limit. And Pages sites are public even if the repository is private, so do not publish secrets.
Step 1: Set DNS records
GitHub warns that extra records can stop the certificate from being created. Any additional A, AAAA, ALIAS or ANAME record on the @ host, or a CNAME that points elsewhere, may block it. Use these records only.
| Domain type | Record | Name | Value |
|---|---|---|---|
Apex (example.com) | A | @ | 185.199.108.153 |
| A | @ | 185.199.109.153 | |
| A | @ | 185.199.110.153 | |
| A | @ | 185.199.111.153 | |
| Apex, IPv6 | AAAA | @ | 2606:50c0:8000::153 and the 8001, 8002, 8003 variants |
| Apex, alternative | ALIAS or ANAME | @ | USERNAME.github.io |
| Subdomain | CNAME | www or blog | USERNAME.github.io |
Check them from your own machine:
dig +short example.com
dig +short www.example.com CNAME
Step 2: Add the domain in Pages
Open the repository, go to Settings, then Pages, and enter the custom domain. If you publish from a branch, GitHub stores the domain in a CNAME file in the root of the publishing source. If you publish with a custom GitHub Actions workflow, that file is ignored and not needed. Static site generators that force push can delete the file, so check that it still exists.
The CNAME file rules from GitHub: the name is all uppercase, it holds one domain only and it contains just the domain name, for example www.example.com.
Step 3: Enforce HTTPS
Under Pages, tick Enforce HTTPS. A repository admin can do this. GitHub then redirects all HTTP requests to HTTPS. If the box is greyed out, the certificate is not ready yet.
Fix: Certificate not yet created
GitHub says provisioning can take some time, and up to an hour for a new custom domain. If it has not finished several minutes after you saved, click Remove next to the custom domain, type it again and save. That restarts provisioning. After you change existing DNS records you may need to do the same.
CAA records
If you use CAA records, GitHub requires at least one with the value letsencrypt.org, or the site will not work over HTTPS. See CAA Records and Let's Encrypt: Fix Blocked SSL and how to check CAA records.
Mixed content after enabling HTTPS
If the page still loads images, CSS or scripts from http:// addresses, browsers block or warn about them. Search your source files for http:// and change each to https://. Test with the free HTTPS checker or the SSL checkerafter you deploy.
Other problems from the docs
- **Wildcard DNS.** GitHub strongly advises against
*.example.comrecords because of domain takeover risk. - **More than one apex or www domain.** Not supported on one site.
- **Browser cache.** After you change or remove a domain, clear the cache.
- **Domain already taken.** Verify the domain in your account first.
If you want more control than Pages gives, the Free SSL on Vercel, Netlify and Pages compares other static hosts. For the DNS side, read how to fix DNS validation errors.
Sources: GitHub Docs, "Securing your GitHub Pages site with HTTPS" and "Troubleshooting custom domains and GitHub Pages".
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.