When I start to setup the blog, I use hexo with pure markdown file and host them using free GitHub.io services. Now I need to use my custom domain name under GitHub.io pages.

Change Repository Settings

The first thing is to change the repository settings and add my custom domain names there.

Change Domain DNS Records

Now go to the domain admin panel and edit the DNS records. Here is a list of tutorial from GitHub.

Root

If you are using a root url as custom domain, for example: jerryshan.com and www.jerryshan.com, you need to add following dns A records pointing to following server (ip).

1
2
3
4
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

You will need to create 4 type A records. The host (Name) will be @, and it points to (Value) each of these IP address. Here is a screenshot for my blog setting.

After this and assume you have update repository setting to pointing to your custom domain, you will be able to visit using your custom domain.

To verify updates succeed, you can using the following terminal command. (Replace my url to yours)

1
dig +noall +answer jerryshan.com

You will see a result like this:

1
2
3
4
jerryshan.com.		599	IN	A	185.199.108.153
jerryshan.com. 599 IN A 185.199.109.153
jerryshan.com. 599 IN A 185.199.110.153
jerryshan.com. 599 IN A 185.199.111.153

Subdomain

For subdomain for example: blog.jerryshan.com, a CNAME record is enough. Create a CNAME record that points to your github.io own domain. For example, mine is nuynait.github.io.

After this and assume you have update repository setting to pointing to your custom domain, you will be able to visit using your custom domain.

To verify updates succeed, you can using the following terminal command. (Replace my url to yours)

1
dig blog.jerryshan.com +nostats +nocomments +nocmd

You will see a result like this:

1
2
3
4
5
; <<>> DiG 9.9.7-P3 <<>> blog.jerryshan.com +nostats +nocomments +nocmd
;; global options: +cmd
;blog.jerryshan.com. IN A
blog.jerryshan.com. 3599 IN CNAME nuynait.github.io.
nuynait.github.io. 3599 IN CNAME sni.github.map.fastly.net.