Winter is coming!
Schedule a 15m mentorship assessment call

Schedule now

Free Hosting! Find out how

Author: Miguel Teixeira
Updated at:2017-12-11
Tags: Resources, Hosting

Are you spending money on hosting? No more! You can use Github to host your startup website for free right now. Read this article to learn how.

So you created a website. Now it's time to roll it out. This is what you need to do before following these instructions:

  • Have a domain,
  • Have a website built,
  • Register on,
  • Install Git.

What is Github

Github is an online service that enables developers to share and develop software. Github is based on Git, a widely used source code management system for software development. So it is critical that you understand some very basic Git scripts. In the course of this article we will teach you how to use Git and Github to get your website published and updated.

Git and Github

In Git and on Github there are a few concepts you need to understand to get your free hosting. First and most importantly, there are repositories which are pretty much projects. Then there are branches. Branches are like different versions or tastes of that project. So your project can branch off into different branches.

DOM files

The DOM files are the files that the browser retrieves from the server where your site is hosted, in order to present a website. They are:

  • html pages,
  • CSS files,
  • JS Files,
  • images,
  • icons,
  • videos,
  • all other elements present in your website.

What is a Domain

A domain is basically the name of your website, like or This name needs to be purchased and you need to hold the credentials to manage this domain, if you want to have a custom domain, instead of using the one that github will give you.

Step 1 – Create Github repository

Go to Github and create a repository on Github for your website. Note that your branch now is called Master.

New repository on Github

Step 2 – Create gh-pages branch

Create a new branched named gh-pages.

New branch on Github

Step 3 – Clone the repository

To clone the Github repository you have just created to your PC, create a new folder named Github and from there open a console by typing cmd, on windows, or terminal, if you are on mac. Then go to the folder you have just created and write the following command:

Git clone [repo url] --branch gh.pages .

Note: The repo url you can find on your repository page on Github where it says https. Copy it to the command and run it.

You will notice that some files have been downloaded.

Step 4 – Adding the DOM files to your repository

Now copy the DOM files to the local repository you have just created. And in the command line write:

  • git add . - please notice the dot
  • git commit -m “[write the description of this first submission]”
  • Git push

The terminal should ask you for your username and password from Github.

After that, if you go to your gh-pages branch in your Github repository you should see the files you have just pushed.

Step 5 – Test your new free hosting

Test your website, through the following URL [username][repository name]

Step 6 – Customizing the domain

Now, to get your site to respond in your custom domain, that you have purchased, add a File named CNAME (all Caps and no extension) and in that file write down your domain to your local repository. Repeat the same steps you did in step 4 (add, commit, push).

Now, go to your domain manager (website where you purchased the domain) and edit the Zone file or change it to this:

Domain zonefile website

or this:
@ 10800 IN A
@ 10800 IN A
www 10800 IN CNAME @

Usually you can do this in DNS management, but it might be located in a different place, depending on the provider you have used.

Make sure that your domain is using the zone file you edited/created.

Note: it may take a few hours before the website is available. These new settings need to be propagated through the ISP, so don't worry if you cannot see your site right after you completed these 6 steps.