How to Point a Subdomain to GitHub Pages

You may recall, in a previous article, we explained how you can point a domain to GitHub to host a static site. In this article, we’re going to show you how you can do the same thing but for a subdomain.

There are many reasons why you might want to use a subdomain. You may want to use a subdomain for testing, or, you may already have a site on your primary domain and would like to point a subdomain to GitHub pages.

Whatever the reason, using a subdomain as a custom domain for GitHub Pages is easy to set up. Follow along with the steps below to see how you can do it.

How to Point the Subdomain to GitHub

In order to accomplish these steps you will only need access to cPanel. You also want to note the GitHub’s IP addresses you can use:

* 192.30.252.153 
* 192.30.252.154
  1. Log into cPanel
  2. Create a subdomain (or us an existing one)
  3. Open the Zone Editor in cPanel
  4. Change your subdomain CNAME to an A Record
  5. Point the A record to the primary GitHub IP address: 192.30.252.153
  6. Add another A record for the same subdomain and point it to the secondary GitHub IP address: 192.30.252.154

Allow Some Time for Propagation

Now that you have pointed your subdomain to GitHub, you may need to wait a few hours for the records to propagate. If the site is not resolving after 24 hours you may want to double-check your input to make sure there are no mistakes in copying.

 

Leave a Reply

Your email address will not be published. Required fields are marked *