Custom domain for GitHub pages

Let's get the website up! — Drama llama.


  • Domain (
  • Subdomain (
  • HTTPS (Optional but strongly recommended).

At the end of the tutorial, you’ll have a set-up, where all requests to will be redirected to

Enable GitHub pages in GitHub settings

  • Go to the repository → Settings ⚙️ → Pages
  • Select Source; Choosing master/main branch will treat as web index.html and choosing /docs will treat /docs/ as web index.html

Figure 1: Enable Gh Pages in GitHub Settings

  • Theme Choose → Choose theme; Choose one among the default themes or clone your favorite from:
  • Wait until GitHub publishes the website. Confirmation message: Your site is ready to be published at

Specify custom domain in GitHub settings

  • Enter Custom domain:

Figure 2: Set Custom Domain

  • Note (recommended to use
    • If the custom domain is, then will redirect to
    • If the custom domain is, then will redirect to

Manage DNS

  • In the DNS provider’s console (GoDaddy in my case), create four A records and one CNAME.
    • In GoDaddy and a few other DNS providers, you will have to specify @ in the name (Leave in black in AWS Route 53).
  • IP addresses for four A records:

Note: These can change over time, refer to the documentation

  • Create a CNAME record to point to <GITHUB-USERNAME>

Figure 3: Set A and CNAME Record(s)

Confirm DNS entries

Confirm CNAME and A records by running dig +nostats +nocomments +nocmd; It should return the four 185.x.x.x IP addresses and one CNAME with <GITHUB-USERNAME>

Note: This can take between an hour and 3 hours for the DNS entries to resolve/propagate. To verify, on the browser: https://<GITHUB-USERNAME> redirects to

Enable HTTPS

The Enable HTTPS checkbox is clickable if everything goes as expected.

Figure 4: Enable HTTPS


  • The checkbox takes time and is not clickable, and it can take as long as a day at times.
  • After you Enable HTTPS, once again, it can take between 1 hour to a day.

Github Support is amazing; in case it takes longer than expected, create a ticket: Github Support

That’s about it! 🚀

Cite this article as: Adesh Nalpet Adimurthy. (Mar 10, 2022). Custom domain for GitHub pages. PyBlog.

#index table of contents