Erik Yuzwa

Fullstack web developer with a touch of PC game development for good measure

10 August 2021

Updating Your Domain to use GitHub Pages in 3 Steps

by erikyuzwa

Over the past few articles on my blog, I’ve been documenting the migration path that I took to move my blog - from a custom, self-hosted domain - over to GitHub Pages.

There’s been a few bumps on the road, but it’s definitely been smoother then what I was anticipating.

In this installment, I’ll be going through the steps to update your own domain DNS records to make sure that https://your-domain.com successfully finds it’s way to your https://<githubusername>.github.io address!

Step 1 - Buy a Domain

If you don’t have one already, then head towards your favorite domain registrar to pick up the custom domain you want.

Step 2 - Update your GitHub Pages Settings

In your GitHub blog repository Settings page, add the custom domain name you bought (or own already) from Step 1.

Note: make sure you do THIS Step before Step 3. It might sound obvious, but there are security implications if you do these steps in the reverse order.

Step 3 - Update your DNS Records

In the control panel of the registrar with your custom domain, there are a few records we need to add.

First off, add a CNAME record with the following settings:

The CNAME will help DNS to resolve requests for customdomain.com to reach githubusername.github.io.

Here’s a screenshot of mine:

Next, we’ll need to add some A records - 4 of them to be precise which will contain the addresses to 4 different nameservers belonging to GitHub.

There’s a GitHub documentation page with these 4 addresses, but I’ll paste them here:


185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Let’s go ahead and create those A records I mentioned:

Repeat this step 3 times, until you’ve got 4 entries - 1 for each ip address.

Here’s a screenshot of my page as a reference:

Step 4 - Profit

It may take up to 24 hours for the DNS record changes to make their way around the internet, but after a period of time you will now be able to use https://your.customdomain.com to reach your GitHub Pages site!

So exciting!

tags: