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

(5 days ago)
Preparing for General Data Protection Regulation (GDPR) https://t.co/RS2J7YN7pJ via @driftingruby


(15 days ago)
ActiveRecord Tricks https://t.co/n5TfzS9s1Q via @driftingruby


(15 days ago)
Optimize your images and encode it in base64 https://t.co/e59VyAwp6B via @redpik


(20 days ago)
Great day at Classic Motorbikes show in Carlow. Well done to organizers for all effort #carlow https://t.co/cbZVUTRnBg


Top of page