📔 Configuring a custom domain for your GitHub Pages site

📔 Configuring a custom domain for your GitHub Pages site
Photo by Rubaitul Azad / Unsplash

Setting up a CNAME for your GitHub Pages does not require additional payment, but you need to have a private domain first. Here, we assume that we have already purchased a domain from Godaddy, so let's go to the Godaddy DNS settings page to configure it.

1. First, query GitHub's IP address via Terminal:

dig xxxx.github.io
dig

2. Go to the Godaddy DNS page and set up 4 A Records and 1 CNAME Record, please refer to the image.

Godaddy Setting

3. Add a CNAME file with xxx.{Domain Name} to the private repo, ex. blog.xxx.com.

CNAME File

4. Set up CNAME on the page and check the Enforce HTTPS option.

Github Pages
Custom Domain Setting

It might take some time to take effect. If everything is set up correctly, the DNS Check in step 4 should pass.


References