Hosting one or more websites on

Github allows you to host a static website on its servers. The benefit is that because it is a static site it can take advantage of their CDN and it is fast. The downside (if you choose to see it as one) is that it is a static site - no database, no server side interaction. Basically read only. Personally I love it and it becomes very useful when using Jekyll to generate the site for you.

Below I’ll go through the very basic steps of setting up a site on and pointing your domain to it


1. Setting up your site on

To create your first site you’ll need to create a new repo on Github called (where username is your Github username). In the master branch add and commit an index.html file. Add a line of text in there so you’ll know it is working: <h1>Hello Github</h1>

Once you pushed these changes point your browser to http://<username> and you should see the index file displayed.


2. Point your domain to your hosted site

Add and commit a new file called CNAME to your repo with a single line of text that points to your site:

The following will differ depending on your hosting provider where the domain is parked but the gist of it is the same in that you need to update your A or C record to point to github. At the time of writing the IP was

  • Login to your cPanel
  • Navigate to Advanced Zone Editor
  • Update the A record of to point to


Name          | Type | Record  
--------------|------|--------------- | A    |


That should be all. If you point your browser to you’ll see your site displayed. Free hosting!


3. Sub project sites

Any other repo (let’s call it popcorn) you may have can be used to host a website. What you’ll need to do is create a gh-pages branch and commit your site to it. It will then be accessible through

However, what if you want to host multiple sites on one github account? In your popcorn repo’s gh-pages branch, add another CNAME file and repeat step 2 above but using your domain.


4. Done!

Once done you should have two repos each with its own domain: in the master branch of in the gh-pages branch of popcorn

Like it? Share it!