How to Use a Custom Domain with GitHub Pages

In our previous <a href="/support/website/git/host-site-github-pages/">GitHub Pages article</a>, we showed you how you can create a static site and host it in your GitHub repository.  This is a simple option for creating a site—with considerable limitations. </p> <p>     Your GitHub Pages site will have its own URL based on your username and the name of the repository.     However, you may want to use a custom domain.   In this article, we'll show you <strong>how to use a custom domain with GitHub Pages</strong>. </p> <div class="alert alert-warning" role="alert">In order for this tutorial to be relevant to you, you must make certain that you have the following:  <ul> <li>A <a href="/support/domain-names/">registered domain</a></li> <li>Nameservers for the <a href="/support/domain-names/changing-your-domains-nameservers/">domain pointing to InMotion Hosting</a></li> </ul> </div> <div class="alert alert-danger" role="alert">You will not be able to use <a href="/support/amp/how-do-i-obtain-an-ssl-certificate/">SSL</a> with on this domain. If you need an SSL for your site, you should consider using a <a href="https://www.inmotionhosting.com/">complete hosting plan</a>.</div> <a name="add-custom-domain"></a> <h2>Add a Custom Domain to Your Repository</h2> <p> Now, we will need to first add our custom domain to our GitHub repository. This will set up a record there, but the change will not take effect until we add the necessary DNS records to <a href="/support/edu/cpanel/how-to-log-into-cpanel/">cPanel</a>. </p> <ol class="article_list"> <li>Log into your GitHub account</li> <li>Select <b>Settings</b> under your repository</li> <li>Add your custom domain under the <em>Custom domain</em> section and click <b>Save</b></li> </ol> <p> A custom domain has now been added to your repository. Below, we'll show how to add an A record in your cPanel that will point to GitHub. </p> <a name="configure-a-record-cpanel"></a> <h2>Add A Records to Point Your Domain to GitHub</h2> <p>     Now that we have added the necessary domain information to our GitHub account, we are going to create custom domain records in cPanel.  This is like adding a physical address to your name in a phonebook.     We will be pointing our domain to GitHub's IP addresses. </p> <ol class="article_list"> <li>Check out our full tutorial on <a href="/support/domain-names/dns-nameserver-changes/a-record-change/">adding an A Record</a> for cPanel</li> <li>Create one A Record for 192.30.252.153</li> <li>Create another A Record for 192.30.252.154</li> </ol> <p>     If your domain is not pointing to InMotion Hosting, you should be able to add DNS records at your registrar.    Once these records have been created, allow at least 4-24 hours for the changes to propagate across the web. 
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? Let us know!