Congrats, you’ve finally created a personal website that you want your own custom domain name instead of using gh-pages to host it. The process of connecting your domain to your gh-pages is quite simple. However, choosing the perfect domain name is the tricky part. I was very tempted to buy a “.ninja” extension, but ended up settling with an “.io.” Additionally, I was stumped as to whether to go with a nickname or my full name. In the end, I chose, kirstenswanson.io.
Github provides, some docs to wire up your domain with your gh-pages, but I’m going to cover the set up in 8 simple steps.
First, the most difficult part…decide on a domain name and buy it on GoDaddy (fingers-crossed you get the domain name you want and someone else hasn’t already taken it).
On the home page of your account the “My Products” tab is selected on default, which makes it easy to click on the “Manage” button.
3. Scroll down to the bottom of the page and click the “Manage DNS” button.
4. Within the DNS management page you will need to make five changes:
In the Type “A” row update the IP address to: 184.108.40.206(this will point your custom domain to GitHub’s server over HTTPS)
In the CNAME row with Name “www” input your gh-pages website (username.github.io)
At the bottom click the “ADD” button and make 3 more Type “A” rows with the IP addresses of: 220.127.116.11, 18.104.22.168, 22.214.171.124(don’t worry when you leave the page it will alphabetize the types)
5. Go to your editor and in the repository of your website create a new file named “CNAME” in the root of your directory.
6. In the “CNAME” file add your domain name purchased from GoDaddy.
7. Add, commit, and push your changes to Github.
8. Within your repository you will need to allow your website to be served through HTTPS. Check “Enforce HTTPS” in the Settings tab of your repo. This permission might take awhile because the certificate needs to be issued, but make sure you check this enforcement option when allowed.
You can confirm that your DNS is set-up correctly by using the dig command in your terminal with your custom domain. You should see that your “A” Types point to the IP addresses that you had specified in GoDaddy’s DNS management page, in other words you’re pointing your DNS to GitHub’s server. Below is an example of the dig command:
If you’re encountering any problems, this GitHub Troubleshooting Custom Domains documentation is a good reference.
And just like that, you now have your very own custom DNS! As a side note, it may take some time for your DNS configuration to update as well as receiving your HTTPS certificate (allow 24 hours), but after that celebrate and share your website!