How to Point a Subdomain to GitHub Pages

You may recall, in a previous article, we explained how you can <a href="/support/website/git/how-to-use-a-custom-domain-with-github-pages/">point a domain to GitHub</a> 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. </p> <p>    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. </p> <p>   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. </p> <h2>How to Point the Subdomain to GitHub</h2> <p>  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:<br/><pre class="code_block">* 192.30.252.153 <br/>* 192.30.252.154</pre> </p> <ol class="article_list"> <li>Log into <a href="/support/edu/cpanel/how-to-log-into-cpanel/">cPanel</a></li> <li>Create a subdomain (or us an existing one)</li> <li>Open the <a href="/support/edu/cpanel/advanced-dns-editor-cpanel/">Zone Editor</a> in cPanel</li> <li>Change your subdomain CNAME to an A Record</li> <li>Point the A record to the primary GitHub IP address: 192.30.252.153</li> <li>Add another A record for the same subdomain and point it to the secondary GitHub IP address: 192.30.252.154</li> </ol> <h2>Allow Some Time for Propagation</h2> <p>  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. 
CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!