GitHub has a nifty feature called GitHub Pages that allows you to serve files in your repository to the web. Those files have to reside in the branch gh-pages, which is different from the usual master branch. To avoid the slightly cumbersome maintenance of two branches, this post shows you how to only work with gh-pages.
Steps:
$ mkdir my_repo $ cd my_repo/ $ git init
$ git commit --allow-empty -m "Initial commit" $ git branch gh-pages
$ git checkout gh-pages
$ git remote add origin git@github.com:joe/my_repo.git $ git push -u origin gh-pagesIf you now go to GitHub, you see that the repository only has a single branch (popup menu “Current branch”).
http://joe.github.io/my_repo/
$ git clone git@github.com:joe/my_repo.git Cloning into my_repo... $ cd my_repo/ $ git branch * gh-pages