This post is meant for all those who have a Github repository containing the code for a website, and have purchased a domain name via GoDaddy, but not the hosting, and want to use the hosting of Github Pages to serve their website. Or in other words, host your website for free using Github Pages.
The post shows how to link your Github Project Repository to a domain you purchased on GoDaddy. Essentially, this means that if you visit your GoDaddy domain, you will see the code of the Github Repository as shown on its gh-pages site, but with your own domain.
Although the demonstration is for GoDaddy, the steps below can be applied to any other web registrar as well.
The process is two-way. You need to tell Github that your repository needs to be served on your own domain, and you need to tell GoDaddy that the IP should point to Github Pages.
The first step involves changing the DNS on your GoDaddy account.
Log in to your GoDaddy Account, and navigate to the 'manage products' section for your site This is what you should be seeing:
Click on the button for 'DNS'. You will be redirected to the Records Page. On the records page, you need to change the Value of Type "A" to Github's IP Address, 126.96.36.199, as seen on the image below. You can edit the Value using the pencil icon at the end of the row.
You can also add another Type A Record, with the IP 188.8.131.52, another alternate for Github. This can be done by the ADD button at the bottom (Pick the Type as A, and enter the IP in the Value box).
Finally, you need to change the CNAME with the name 'www' to point to your github.io website (the gh-pages for your repository). For example, if my project name is exampleabc, the value should be exampleabc.github.io. The image below shows what your updated records should look like.
The last step wraps up the procedure. You need to go to your Github Repository, the one you want to host on Github Pages. Click on settings, and scroll down to the Github Pages section. In the last box of the section, entitled Custom Domain, you need to enter the GoDaddy domain name, and click on save. If you refresh the page, you should now see a green confirmation message saying 'Your site is published at http://...'
Two roads diverged in a wood, and I--