Hosting Jekyll Site using Github Pages

1 minute read

At this point, you have a basic site that you can host on your own server. If not, checkout this blog on how to get started with Jekyll to build your own site.

Github allows users to host one main site and unlimited project sites per account. All the github repositories hosting a github page must be public, unless you have Github Pro. Checkout here on How to get Github Pro as a student.

Steps to get started with Github Pages(skip if any step is already done):

  1. Create a new repository on Github with name as username.github.io. Example: if my github username is girishnadiger, then i will have to create a new repository with the name girishnadiger.github.io.
  2. If you are hosting a project site, then create another repository for that respective project. This doesn’t need to follow any naming convection. Example: if my project is called sudoku-generator then you can create a repository with the name sudoku-generator.

For this blog, we will he hosting into the main github page, which can be accessed as username.github.com.

As a first step, clone your respective repository (hereafter referred as username.github.io) into your computer. Then copy the site code and files into the repository, commit the files and push the commits to github. Commits can reside in any branch.

Now once the site files are present in github, go to the username.github.io > Settings > Pages. Now select the branch where your code is present and select base path (keep it default if you haven’t added the files under /docs, else select /docs), then save the new settings. Thats it, your website is hosted and should be accessible under username.github.io (in my case https://girishnadiger.github.io)

Here is a link to Github’s detailed documentation on how to host a Jekyll site using Github Pages.