Linda Ojo

How to host a website with a custom domain name on Github

Published: 2020-01-04

In this article, I am going to help you host your website on Github.

Not too long after becoming a developer, an urge comes upon you to create a personal website. you can only resist for so long. I gave in two days ago and I am happy to say you can check out my personal website

After creating my simple personal website, I had to host it and connect a custom domain name, here is how I did that.

Create a Repository on Github

Create a public repository for your website and name it what you want. My repository looks like the image below. Make sure your master branch is up to date with all your files and renders your desired website.

Create Repo

Change source of Github page

Open your repository and click on settings

Change Source of Github page

The scroll down to Github Pages and change source to Master Branch and then put in the custom domain you have purchased. If you don’t have one, you can get at NameCheap or any other domain seller.

Change Source of Github page

A CNAME file will be automatically added to your project as seen below.

Manage your Domain

If you are on NameCheap, navigate to the Domain list and click on Manage for the corresponding domain. Under Advanced DNS (Domain Name System), replicate the list of records below. Make sure to use [yourusername] in the CNAME record.

Change Source of Github page

That's it! You have connected your domain name to your website. It should take at most 30 minutes for this to work. check out your website using your new domain name and smile.

Subscribe to Newsletter

Be the first to know about quality articles and poems written by Linda Ojo.