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 {Your Domain}.github.io
dig xxxx.github.io

dig

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

godaddy setting

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

CNAME File

  1. 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