← Back to home

How to Use a Custom Domain for a GitHub Pages Site

Published March 2026 · 7 min read

If your site is hosted on GitHub Pages, you can use your own domain (for example, blog.example.com) instead of the default username.github.io. This guide walks through the full setup with the safest path and common fixes.

Official reference: Configuring a custom domain for your GitHub Pages site.

1) Decide your domain style

Subdomains are usually easier to configure and maintain, but both options work with GitHub Pages.

2) Add your domain in GitHub Pages settings

In your repository (GitHub Docs: Managing a custom domain for your GitHub Pages site):

  1. Go to SettingsPages.
  2. Under Custom domain, enter your domain and save.
  3. Wait for GitHub to create/update the CNAME file in your repo.

3) Configure DNS records at your domain provider

At your DNS provider (Cloudflare, Namecheap, GoDaddy, etc.):

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

If your DNS provider supports ALIAS or ANAME for root domains, you can use that instead.

4) Enable HTTPS

Back in GitHub Pages settings, turn on Enforce HTTPS after certificate provisioning is complete. This can take a little while after DNS starts resolving.

5) Verify the setup

For better security, verify domain ownership in GitHub: Verifying your custom domain for GitHub Pages.

Common issues and fixes

GitHub maintains an official checklist for DNS and HTTPS issues: Troubleshooting custom domains and GitHub Pages.

Once this is done, your site will load from your own domain while still being hosted for free on GitHub Pages.