Using GitHub as hosting with custom domain

Step 1

Create a new GitHub repository with gh-pages as default branch

Create a new GitHub repository for your P3 project, or whatever site it is that you are creating.

Commit and sync your local website files to this new repository.

Once you have some files, navigate to the main repository page on GitHub. Where it says "Branch: master" click and create a new branch called "gh-pages".

In the settings for the repository, change the default branch from "master" to "gh-pages".

Step 2

Link your domain to the repository

On your repository page on GitHub, go to the settings page. Scroll down to "GitHub Pages" and underneath you should see "Custom domain"

Fill in your custom domain name. No need for www. Just type "mydomain.com".

Step 3

Add A records to your domain

Log into your DNS provider. (Mine is name.com -- this is wherever you bought your domain.)

Navigate to the area on the site where you can edit the domain's "DNS Record".

Add two "A Records" here. One has the answer of "192.30.252.153" and the other "192.30.252.154".


Resources:

Setting up an Apex Domain
Troubleshooting Custom Domains


Updated on July 27, 2016