GitHub Pages lets you host a static website for free directly from a GitHub repository. You can use a custom domain — for example, pointing yourdomain.com at a GitHub Pages site — by adding a few DNS records.
Records you need to add
GitHub Pages uses four IP addresses. To point a root (apex) domain like yourdomain.com at GitHub, add four A records:
| Type | Name / Host | Value | TTL |
|---|---|---|---|
| A | @ (or leave blank) | 185.199.108.153 | 14400 (default) |
| A | @ (or leave blank) | 185.199.109.153 | 14400 |
| A | @ (or leave blank) | 185.199.110.153 | 14400 |
| A | @ (or leave blank) | 185.199.111.153 | 14400 |
And for the www version of the domain:
| Type | Name / Host | Value | TTL |
|---|---|---|---|
| CNAME | www | <your-github-username>.github.io | 14400 |
Replace <your-github-username> with your actual GitHub username (or the organization name that owns the repository).
Where to add the records
Where you add these depends on whether you have CanSpace hosting or a domain-only registration:
- Domain-only (no CanSpace hosting) — use the DNS Manager in the client area. Domains → My Domains → Manage → Manage DNS Records. See How do I manage DNS entries? for the walkthrough.
- Domain + hosting on CanSpace — use the Zone Editor in cPanel (Domains section). If you want your website files to come from GitHub instead of your CanSpace hosting, you'll remove or update the default A records that point your domain at the hosting server and replace them with GitHub's IPs.
At the GitHub side
In your repository's settings on GitHub:
- Go to Settings → Pages.
- Under Custom domain, enter your domain (e.g.
yourdomain.com) and click Save. - GitHub will verify that the DNS records are pointing correctly — you'll see a green check once it's confirmed.
- Tick the Enforce HTTPS box once the certificate is provisioned (usually within an hour of DNS validation).
Waiting for propagation
DNS changes propagate gradually. Most visitors will see the GitHub version within 15 minutes to a few hours, though full propagation can take up to 24-48 hours. You can check whether propagation is done using a tool like dnschecker.org — enter your domain and look for the 185.199.* IPs.
Subdomain (e.g. docs.yourdomain.com)
If you only want a subdomain pointed at GitHub Pages (instead of the root domain), skip the A records and just add a CNAME:
| Type | Name / Host | Value |
|---|---|---|
| CNAME | docs (or whatever subdomain) | <your-github-username>.github.io |
Related articles
Having trouble getting GitHub Pages to recognize your custom domain? Open a support ticket