If you have a custom domain you can quickly set it up with your Jekyll site hosted on GitHub Pages. By default, GitHub Pages sites come with domains ending in
github.io. To use it with a custom domain, you only need to configure your DNS settings.
The big thing about GitHub Pages is that GitHub lets you host your static website on its servers for free. Besides, since May 2018, it even offers free HTTPS support for custom domains.
I will discuss the most typical use case when you want to point both the apex domain and the
www subdomain to GitHub Pages. The apex domain is the (non-www) root domain without a subdomain, for instance,
annalytic.com for me. There are other, more complicated use cases as well—GitHub Docs detail all of them comprehensively.
There are two places where you need to configure your DNS settings:
Go to the Settings page of the GitHub repo of your site and enter your custom domain into the "GitHub Pages" section.
This setting automatically creates a
CNAME record in the root folder of your repo. CNAME stands for Canonical Name and DNS servers use it to alias one domain name to another. You can also make GitHub use HTTPS with your custom domain by ticking the "Enforce HTTPS" checkbox.
Log in to your account at your domain provider and navigate to the "DNS Management" (or similarly named) section inside the admin area. Here, you need to do two things:
Arecords that point your apex domain to GitHub Pages' servers. You need to create four
CNAMErecord that points the www subdomain to your default GitHub Pages site.
Here are the five DNS records you need to set up:
Host Name Record Type Address @ A (Address) 126.96.36.199 @ A (Address) 188.8.131.52 @ A (Address) 184.108.40.206 @ A (Address) 220.127.116.11 www CNAME (Alias) yoursite.github.io
You usually have to wait up to 24 hours until the changes propagate. Then, you can check the health of your DNS servers by running a free DNS test with a provider such as Leaf DNS. You should see something like this:
GitHub also shows a warning if there are any problems with your configuration. That's all.