March 22, 2016


How to Add Github.io to Namecheap Domain

As you probably know, you can create username.github.io, and Github will host your static website. What if you want this username.github.io to be a different domain name that you purchased on namecheap? Let’s say that I have buhpc.github.io, and I want it to be buhpc.com, which I have purchased on namecheap. How exactly do I do that?

Add CNAME to username.github.io

We should add CNAME to our username.github.io. We can easily do this through the terminal or website GUI. I’ll show you how to add a new file called CNAME on the website GUI. We’ll visit http://github.com/buhpc/buhpc.github.io. There’s a New file button next to New pull request button. Click it.

github-io-website

Now, we name the file, CNAME. Inside the large text box, we write the name of the domain that we have purchased on Namecheap. For me, I wrote buhpc.com inside the file. At the bottom, we click the Commit new file, green button.

add-a-CNAME

Now, what we see is that we have committed the CNAME file, and it appears within our git repo.

CNAME-added

 

Adding the Host Records to Namecheap

We visit https://namecheap.com and log into our account. On the list of domains that we own, hit Manage next to the domain that we want to link to github.io.

manage-subdomain

Now, we want to select the Advanced DNS tab.

advanced-dns

At the bottom, we can add the following four Host Records as part of the Advanced DNS.

Make sure that you hit Save All Changes.

what-to-add-to-namecheap

After waiting up to 30 minutes, when you visit buhpc.github.io, your site should redirect to buhpc.com and vice versa. Visit your username.github.io or your domain name!