Build a Website with Github Pages

Sometimes you just want to set up a quick website and it isn’t feasible to share your localhost. Github pages are a great way to do just that. The following walks you through the setup for a Github page.

Let’s get started:

Create Your Github Page

  1. Log into GitHub and create your GitHub repository.

  2. Give your repository a name and description and then follow the directions for creating your new repository. The github repo for this tutorial will be called gh-data-1

  3. As part of the setup process you will create a local folder for your project, initialize it for git and push it to your GitHub account. When you finish the setup process, there should be a in your GitHub repository

  4. In your local repository, create a new branch called gh-pages. git checkout -b gh-pages

  5. Add an index.html file in your local repository like the one below – just a blank template with a heading

    <h1>My Page</h1>
  6. Push the gh-pages branch to your github repo
    git add .
    git commit -m "Create the gh-pages branch and add index.html"
    git push origin gh-pages -u
  7. Now you can visit your GitHub Page to view your index.html file.

That’s all for today. We now have a publicly accessible website for free.