Redirecting Github project pages to a custom domain

27 December 2015

Recently, Julia set up this site, and I purchased the domain superrr.ninja for it to live at. Finding how to redirect it - as it was a project page rather than a user page - was a little counter-intuitive at times, so in case anyone else wonders in the future, here’s what I did:

(Before following these instructions, you’ll probably have followed these instructions to set up a project page)

  1. As this Github documentation says, set up a CNAME file to the project repository with just the domain name that you want to use - in our case, it looks like this:
superrr.ninja
  1. I found these instructions from Github on how to configure the DNS settings with your provider, but I wasn’t so sure what to actually do after reading them- the answers from Stack Overflow also helped. In short, though: on whatever service you used to buy your domain, you need to add two A Records in ‘Settings’, with the following details. In my case using Namecheap, I found this option in ‘Advanced DNS settings’, and added two ‘A Records’ which point to
192.30.252.154
192.30.252.153

so it looks like this: (this is a screenshot from Namecheap)

namecheap-screenshot

and, in the same settings, modify the CNAME record so it reads as

username.github.io.

…where ‘username’ is your username. Note the “.” at the end, too.

This is the part I found counterintuitive - at no point in the DNS records do you write what the project name is, just having the CNAME in the project repository is apparently enough.

After a few minutes, your custom domain should work!


You might also like: