Here’s a boilied down method to configure add a custom domain (e.g., username.com) to your github pages website (e.g., username.github.io).
Buy a domain (e.g., richpauloo.com). I used godaddy.com, but you can use any number of domain name registries.
In your github.io repository Settings, add the domain you purchased in Step 1 to the “Custom domain box”:
Make sure you do Step 2 before Step 3, for security reasons outlined in the Official Github docs.
In your DNS Management console, add a CNAME record with the following parameters:
- type = CNAME
- name = www
- value = username.github.io.
Meaning: This tells your DNS to point www.username.com requests towards the site hosted at username.github.io. Set the TTL (time to live) to an hour or less.
Next, in your DNS Management console, add 4 separate A records with the following information:
- type = A
- name = @
- points to (value) = IP
For IP, supply the Github IP addresses that host your username.github.io site. As of writing (2019-11-15) these IPs are:
188.8.131.52 184.108.40.206 220.127.116.11 18.104.22.168
However the values might have changed since the time of writing. See the offical docs for the most up-to-date values.
Meaning: “A” records connect your domain name (hosted by your DNS) to the actual IP addresses where your site lives on a server (at Github).
Nagivate to username.com to see your github page! Be patient if it doesn’t immediately show. This lag is related to DNS propogration.
Here are three resources I found helpful while doing this: