In this article, I am showing you how to host a static website on GitHub Pages for free, including setting up continuous deployment.

What & why GitHub?

GitHub is hosting service that allows you to secured your software source courses and other text based projects. Creating a Github Page doesn't take long, but there's a few things you need to fulfill before start

Prerequisites

* GitHub Account

Before Starting make sure that you have a GitHub account. If not, you can simply obtain a GitHub account from here.

* Git installed, and configured on your machine

Git is a version controlling system that tracks each and every change you did you to files in a project. It keeps records on what the changes were did to files (what was added? what was removed), who made the changes, notes and comments about the changes by the changer and also it keeps records on the time which the changes happened.

Create Repository

Head over to your GitHub and create new repository. To show the content in your repository as a static web page on GitHub pages, repository name should be in following way username.github.io. Username can be your username or organization username.

Choose Git client

  • A Terminal
    If you are familiar with terminal, you can go to the folder where you want to create your project. Then you should clone the project using follwing command.
    1
    git clone https://github.com/username/username.github.io
    Then go to your project directory and start working on coding. After coding part is finished, you can simply push it to your GitHub repository by using below coomands,
    1
    2
    3
    git add . 
    git commit -m "Initial Commit"
    git push -u origin master
  • GitHub Dekstop
    If you are like to setup your project using GitHub Deksop, you can clone the repository by clicking on the “Set up in Desktop” button. Then you can open that project on your favorite text editor and work on it. After modifications have done, you can commit your changes and publish it.

Share your work

Now we have finished our coding part. Now you can fire up a browser and go to https://username.github.io.
Do you wanna see what I hosted in GitHub Pages?