Github pages is powered by Jekyll, so it is ideal for hosting your Jekyll website. Read more about hosting your site on Github pages here.

To deploy your site to Github pages:

  • Follow instructions on jekyll-on-github to add code to your gemfile.
  • Runbundle install to install github-pages in your Ruby gems folder.
  • Assuming you have a github account, create a new repository yourname.github.io.

If you set up your local site in the conventional way, it will have a .gitignore file containing, among other folders and files, the _site folder. This folder does not need to be pushed to github pages as github itself takes care of generating the pages from the other files.

  • Using Git Bash (on Windows), navigate to your jekyll folder.
  • Run git init. This creates a folder .git with nothing much in it.
  • Run git remote add origin https://github.com/yourname/yourname.github.io.git. This adds the url of your repository to the config file in your .git folder.
  • Run git add ., then git commit -m "first commit", then git push -u origin master.

When you navigate to yourname.github.io in your browser, you should see your site!

If you have a domain name set up, add the file CNAME in your root folder, with just one line - your domain name, eg. yourname.co.uk.

An alternative

Github pages does not, at the time of writing, support any version of jekyll pagination - jekyll-paginate (deprecated), jekyll-paginate-v2 or octopress-paginate. As this site uses pagination, I’ve used an alternative solution. My live files only are hosted on github, that is, the contents of the _site folder.

To do this:

  • Navigate to _site within your jekyll folder.
  • Run other commands as above.

You should still see your site yourname.github.io, or at the url of your domain name, if you have one and have added a CNAME file to your site root.