Your Custom Domain for Github Pages

November 25, 2022 0 Comments

Github not only gives us free Github pages but also allows us to use our own domain name for the page we created. So instead of using the following name format: {username} / {project name}, you can call the blog like this instead.

This is a great opportunity for free open-source projects with a lack of financial support to host your website or blog. You don’t have to worry about exceeding the bandwidth limits or burning your fingers if the project suddenly becomes very popular. There are a number of projects that use this feature, including Bootstrap, Jekyll, Yeoman, and Foundation – and many more.

In the previous article on Jekyll, we showed you how to implement our Jekyll-based blog on Github Pages using the Github name format. In this article, we are using a custom domain for this blog.

Note: at this point, we’ll assume you followed our previous tutorial where you already installed the Github app and created a GitHub page for your blog.

Creating a CNAME file

Let’s open the Github app (for Mac, for Windows). In the Branches panel, switch the working branch to GH pages. create a new file named CNAME in the root folder of our local Git repository. For example, write your domain name for the website / blog in it, -note that we can only add one domain to the CNAME file.

Show DNS

Next, we need to target our DNS for this domain to Github pages in the CNAME file. In this example, I use cPanel. Log in to cPanel and navigate to the advanced DNS Zone Editor.

Now we have to wait for the DNA to spread. it can take 24 hours or just a few minutes. If this is the matter, you should be able to access your website and blog through your own domain name.

Leave a Reply

Your email address will not be published. Required fields are marked *