Deploying Jekyll to online server is so easy, as it is only a static website. All you need is shared hosting with decent hard disk space and bandwidth sufficient enough to host it. The cost for shared hosting should be affordable. But then again, why worry when you can host a Jekyll blog completely for free – using Github Pages.

Github offers Github Pages for free for anyone to host their static websites. It has Jekyll built-in, so it is a good place to host our Jekyll-powered blog. In this article, we will show you how to deploy our blog to Github Pages.

Getting Started

First, you need to have a Github account. Once you have one, create a new repository. The name of your repository will be used for the blog address in the following format {username}.github.io/{repo-name}.

In this example, I will name my repository simply as blog. When the repository has been created, copy the clone url.

Add, Commit, and Push

We are going to upload our local Jekyll files to our newly created Github repository. I will use Github for Mac to do the job, which can be downloaded for free – Github for Windows is also available for Windows users.

Let’s launch Github app, and then add our Jekyll blog directory as a Local Repository.

Github Pages Branch

Creating a Github page for a repository is as easy as creating a new git branch. In the Github app, go to the Branches tab. Create a new branch named gh-pages of the master branch, and click the Publish button.

Troubleshooting

If the blog is not styled properly, this could be because the stylesheet is not linked properly. To solve this issue, open the default.html in _layouts folder. You will see that the stylesheet is initialized with a slash sign, /.

<link rel="stylesheet" href="/css/syntax.css">

Omit that first slash, so the path looks like the following:

<link rel="stylesheet" href="css/syntax.css">

Then Commit the change, and Push it to Github. The blog should now be displayed properly.