Create a Jekyll blog on GitHub in 12 easy steps

Blogging with Jekyll and GitHub Pages is a real pleasure. Write your posts in simple Markdown, push to GitHub, and Bob's your uncle. Setting up a blog and hosting it on GitHub Pages will only cost you 5 minutes of your time. Just follow the steps below.

Jekyll default site (image opens a new tab):

12 easy steps to blogging happiness

The following assumes you have Ruby installed on a Linux machine and that you have registered an account on GitHub.

  1. Create a new repository on GitHub. In the example below, the repository is called simonsblog. You can simply replace simonsblog with the name of your blog and BreslawScripts with your GitHub username.
  2. Install Jekyll and the Gem Bundler on your local machine:
    gem install jekyll bundler
    
  3. Create a folder with your new blog:
    jekyll new simonsblog
    
  4. Move into the new directory:
    cd simonsblog/
    
  5. Build your blog and browse to http://localhost:4000 to see a local version:
    bundle exec jekyll serve
    
  6. In the _ config.yml file in your local folder, replace the line base_url:"" with: `
    base_url:"/simonsblog"
    
  7. Initialise the Git directory:
    git init
    
  8. Create and switch to a GitHub Pages branch:
    git checkout -b gh-pages
    
  9. Add your files to Git:
    git add .
    
  10. Commit:
    git commit -m "initial blog commit"
    
  11. Link your local folder to the remote repository on GitHub:
    git remote add origin https://github.com/BreslawScripts/simonsblog.git
    
  12. Push the local files to GitHub:
    git push origin gh-pages
    

Congratulations!

Your blog is now online at:
YOUR GITHUB USERNAME.github.io/YOUR BLOG

What next?

Add new posts and make changes to the default site layout on your local machine (see the fantastic Jekyll docs). Then, when you're done, update your live blog:

bundle exec jekyll build
git add .
git commit -m "your commit message"
git push origin gh-pages

Automate your commit and push tasks with a Rakefile

See the following blog post on how to automate the commit and push process:
Automate shell commands with a simple Rakefile