How to link a custom domain to Github Pages with HTTPS

Whenever I host a Jekyll site on GH pages, I usually spend an extra hour or two on tiny details that I want to record in this post, which is a boilied down set of instructions to add a custom domain (e.g., to a Github Pages site that may be either your default github site (, or a project page in another repo

Step 1

Start with a boilerplate Jekyll theme to host your site or project page (here's a recent one at the time of writing). Change the contents of the CNAME file to

Next, in the Github repo Settings, add your custom domain into the “Custom domain” box, ensuring that it's preceeded by the www subdomain:

Make sure you do Step 1 before Step 2, for security reasons outlined in the Github docs.

Step 2

In your DNS Management console, delete any CNAME record that points www to @, and add a CNAME record with the following parameters:

type  = CNAME
name  = www
value =

Meaning: This tells your DNS to point requests towards the site hosted at Set the TTL (time to live) to an hour or less.

Next add 4 separate A records with the following information:

type  = A  
name  = @  
value = IP   

For IPs, use the Github IP addresses that host your site. As of writing (2019-11-15) these IPs are:

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 the custom domain (hosted by your DNS) to the actual IP addresses where your site lives on a Github server.

Step 3

Back in the Github repo settings, do hard reset, and click “Enforce HTTPS”:

Navigate to to see your github page! Be patient if it doesn't immediately show due to DNS propogration.

Here are three resources I found helpful while doing this:

  1. Offical docs
  2. An unoffical guide.
  3. Nice explanation of A records
  4. Stack overflow guide
  5. helpful blog
Rich Pauloo, PhD
Data Scientist

My interests include data science, hydrology, geology, physical simulation, building simple solutions to complex problems, and expedition behavior.