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:
* 126.96.36.199 * 188.8.131.52
- Log into cPanel
- Create a subdomain (or us an existing one)
- Open the Zone Editor in cPanel
- Change your subdomain CNAME to an A Record
- Point the A record to the primary GitHub IP address: 184.108.40.206
- Add another A record for the same subdomain and point it to the secondary GitHub IP address: 220.127.116.11
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.