DEV Community

Austin Repp
Austin Repp

Posted on • Originally published at austinrepp.com

How to set up a free custom domain on Github Pages

For this tutorial I will be assuming you have already setup a site on Github Pages that's being run on the standard USERNAME.github.io domain. If you haven't done so, a quick Google search will yield lots of articles explaining the process. I'm using Bluehost as my domain provider, but the steps should be similar for any major domain provider.

Setup in Github repository

In your Github repo for the site, navigate to the "Settings" tab. Scroll down and you will find an area for Github Pages setup. In the Custom Domain section, enter the domain name you want to use and click save.
Github Domain
If you're using a static site generator, you may already have a file in your repo called CNAME. If you don't, you can create one. Inside this file, place the domain name.
CNAME

Host record setup

Now open the domain provider that you are using, and navigate to the DNS section for the domain you are interested in using.

First you will need to add four A host records. The host record for each of these is "@". The image below shows what it looks like on Bluehost.
A host
The four IP addresses (at the time of writing this) for each record to be added are:

  • 185.199.108.153
  • 185.199.109.153
  • 185.199.110.153
  • 185.199.111.153

Next, we need to add a CNAME record for the www site record. This will be in the format USERNAME.github.io
CNAME

That's it! The records will probably take some time to update, so be patient. After they update you should see your site live on the domain you've provided.

Top comments (0)