Host your website with GitHub

Posted: 25 August 2013, Category: Coding

Did you know that GitHub is capable to host a simple website for free, well I didn't but I found it interesting enough to write a blog post about it.

That's right, if you have simple website containing HTML, CSS and JavaSript, GitHub will happily host your website for free.

GitHub also offers possibility to add domain name or sub-domain name if you have domain registered.

For those who have little or no knowledge of coding and need simple website to show their graphic artwork for example I recommend to check out http://pages.github.com/ and read documentation.

Web Designers and Web Developers with coding and basic Git skills can create own depository which is needed to publish website through GitHub.

As you probably guessed from blog title this post is about setting up free web hosting and custom sub-domain for free thank to GitHub.

Creating GitHub remote repository and gh-pages

  1. Create GitHub remote repository
  2. Push files from local git repository to master branch in remote repository created
  3. Create branch gh-pages
  4. git branch gh-pages
  5. To see branches in repository
  6. git branch
  7. Push files from master branch to gh-pages branch
  8. git push origin gh-pages
  9. In couple minutes is possible to see your website hosted on free GitHub account by typing yourusername.github.io/nameofrepository

Well done, now is the time to add custom domain name or in my case sub-domain name

  1. Create sub-domain in domain manager such as subdomain.josefzacek.com
  2. Create CNAME record and point it to your GitHub account such as josefzacek.github.io
  3. Create file called CNAME on your local computer
  4. Type name of sub-domain created in CNAME file
  5. Add and commit changes to local Git repository and push them to remote GitHub repository
  6. Push files from remote GitHub master branch to remote gh-pages branch
  7. git push origin gh-pages
  8. It again takes a couple of minutes to propagate but eventually your website will be available at subdomain.josefzacek.com

I hope you enjoyed GitHub post and if you have any questions or suggestions please do not hesitate and contact me.

Back to Blog page

Blog categories

Twitter feed

(11 days ago)
RT @Netlify: ⚡️Announcing that we have raised an additional $30m led by @kpcb’s Mamoon Hamid, with @a16z and the founders of @SlackHQ @Yelp…


(20 days ago)
CSS Filter Playground https://t.co/ZOl7SOGI5S


(20 days ago)
“5 steps to speed up your image heavy website” by @BrandonMorelli https://t.co/UE1G7EQjlQ


(25 days ago)
“How browser rendering works — behind the scenes” by @OhansEmmanuel https://t.co/NJY1YzEgU4


Top of page