How to host a website with a custom domain name on Github
Published: 2020-01-04In 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.
Change source of Github page
Open your repository and click on settings
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.
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].github.io in the CNAME record.
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.