How to Setup Custom Domains for Github Pages
Geeks Corner How To Resources

How to Setup Custom Domains for Github Pages

Github gives people a great option as Github Pages to host their static websites, open source projects or blog for free. The best thing is it gives us a lot of flexibility as we do not have to worry about bandwidth limits or hosting spaces etc. Apart from that, Github Pages gives us option to use our own custom domain for the project we are hosting on Github. Setting up a custom domain for your project on Github is pretty straight forward. Just follow below steps, and if you stuck somewhere, just ask the questions in comments section, and I will answer them ASAP.

*I am using screenshots from GoDaddy DNS management, but it will be similar for all hosts.

  • Create a file and write your domain name which you want to setup for the project. If you want to use a naked domain ( just write or if you want to use it with www, then write it with Save it with the name CNAME. The file will not be having any extension, just the name CNAME. Upload the file to your root directory in Github.


Second step is pointing the DNS from domains DNS management. For that you need to login to your domain/hosting provider. In case of Godaddy, follow below steps, for other hosts, the panel may be slight different visually, but options will remain same. I’ll try to get and upload screen shots from more hosts.

  • Click on the plus symbol which is beside the text Domains.
  • Click on Manage DNS, which will take you to a new page which will look something like this.

Now, you need to create 3 exact same records as shown in above image. First, create 2 A records which will points to Github’s IP addresses. Just follow along.

  • Click on ADD, from type dropdown select A.
  • In Host box, write @, in Points to box, write the below IP addresses. Leave the TTL field as it is and save the records.

Now create CNAME which will point your domain to your Github page.

  • Click on ADD, from type dropdown select CNAME.
  • In Host box, write www, in Points to box, write your Github Page URL, which will be something like, leave the TTL to their default values and save the changes.

If you have done everything right, you must be having 3 records as shown above. Now you need the DNS some time to propagate, which may takes 0-24 HRS, and once it is done, you can access your site on your custom domain.