In our previous GitHub Pages article, 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.
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 how to use a custom domain with GitHub Pages.
Add a Custom Domain to Your Repository
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 cPanel.
- Log into your GitHub account
- Select Settings under your repository
- Add your custom domain under the Custom domain section and click Save
Add A Records to Point Your Domain to GitHub
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.
- Check out our full tutorial on adding an A Record for cPanel
- Create one A Record for 188.8.131.52
- Create another A Record for 184.108.40.206
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.