DEV Community

Cover image for Hosting with GitHub Pages
Harish for Right From Basics

Posted on • Updated on • Originally published at rightfrombasics.com

Hosting with GitHub Pages

Did you know you can host websites with GitHub Pages? In fact, so far, all my websites have been hosted with GitHub Pages. See my Projects. All the websites there under the domain harishv.me are hosted under GitHub Pages. Let's see why is it so awesome.

The Great Stuff

1. It’s free!

GitHub Pages offers free hosting of your websites/apps etc. That’s right, its totally free. (There’s a catch though, check the limitations below).

2. Connected to your Git repository

Version control is crucial for any project you do. GitHub Pages is connected with your GitHub repository, which means once any changes are pushed, your website is automatically rebuilt and deployed for you. The individual sub-pages that see - my blog, my projects, my photography page are all individual GitHub repositories. The main page is a GitHub repository named <your-github-username>.github.io on the master branch. To deploy other repositories under your GitHub Pages domain, you simply push your changes to a gh-pages branch.

3. Custom domain names

By default GitHub Pages offers the domain http://<your-github-username>.github.io. This is good enough for many hobbyists to try deploying their local projects on the web. But if you want a custom domain, you can do that too. Simply register for a domain name on sites like Namecheap or GoDaddy and connect them to GitHub pages. My site domain harishv.me is registered on Namecheap and connected to my GitHub repositories.

4. Jekyll blogging support

GitHub Pages supports Jekyll, which means you can create blogs and deploy them. Jekyll is a powerful Markdown-based blogging tool. All you need to do is run a few Jekyll commands after writing your posts and Jekyll builds static sites which you can easily push to GitHub. My blog is built with Jekyll as well. It’s a great way for people who prefer pure code-style of blogging. Also, all your posts can be easily backed up as they are all in a text-based Markdown format.

5. Great Uptime

GitHub is almost always up with some rare cases of downtime. This means that it provides reliable service in ensuring your webpages are live 99% of the time. That’s one huge bonus for a free service. You can check on the GitHub system status here.

Limitations

This is a rather short section since there aren’t many disadvantages I can think of. There are rather limitations with GitHub Pages.

1. Only Hosts Static Sites

While its true that GitHub Pages offers free hosting, it does not support full-fledged dynamic sites. Rather you can only host static sites which means they are in pure HTML, CSS and JavaScript. Essentially, there is no server-side support where you can for example do database-related operations etc. Nevertheless, this alone is powerful enough for some projects. All my pure front-end based projects are hosted with GitHub Pages. I have made many of those with the combination of HTML, CSS, JavaScript, libraries such as ReactJS and jQuery, and frameworks such as Bootstrap or Foundation.

2. Only supports GitHub repositories

Of course, GitHub only supports repositories from itself. If you use another platform like Atlassian BitBucket for version control then you will not be able to utilise GitHub Pages. If you are using BitBucket, you are in luck since they too offer support for hosting static sites. Check this FAQ section for more information.

Looking for Hosting?

Both services offer great uptime and customer service. Oh did I mention - you get a free domain name with both Bluehost and Hostinger!

Top comments (0)