GitHub has a great feature called GitHub Pages where they’ll vend your static files via http. It’s the best deal in town.
All you need to do is have a branch named gh-pages and perhaps push a button to engage the feature the first time you use it for a given repo.
Sometimes a project is nothing but a jumble of files that should be accessed via http, so having a master branch along with a gh-pages branch is just needless complexity.
Fortunately, it’s easy to create a Github project that consists solely of a gh-pages branch. No fuss, no master muss.
Here’s how I did it:
Create a new Github repository
Create a local repo:
mkdir JSRegexTeststand
cd JSRegexTeststand
git init
bbedit index.html
git add index.html
git ci -m 'initial commit'
Now we have a master branch hosting one commit. The trick is to rename master to gh-pages:
git branch -m master gh-pages
With our branch rename in place, we can push our lone branch to GitHub:
git remote add origin git@github.com:rentzsch/JSRegexTeststand.git
git push origin gh-pages
If all went as planned, your files should now be live at http://$username.github.com/$reponame/.
I noticed I didn’t have to manually click Admin -> GitHub Page: Generate Your Project Page link as mentioned in the documentation. I think GitHub now automatically generates your pages when upon receiving a gh-pages branch but they haven’t updated the docs yet.