Create A Github Blog Using Octopress

Learn how to create a Github blog in this short Octopress tutorial.

If you are not into coding then I recommend that you build a WordPress website.

Summary To Create a Github Blog

  • Install Octopress
  • Setup Github Pages
  • Add remote repository
  • Review git branches
  • Preview on development
  • Deploy to Github
  • Create posts in development and deploy
  • Add a custom domain

Environment

Ruby 1.9.2p320. MAC OSX 10.9. Vim. iTerm2

Prerequisites

  • Install Ruby, git
  • Have a github account
  • Basic knowledge of git and github
  • Confidence about the command line
  • Get a domain if you want to add a custom domain

References

Octopress documentation

Installation Process of Octopress

Go to the terminal and clone the Octopress repo:

git clone git://github.com/imathis/octopress.git octopress

cd octopress
    bundle install

This command installs Octopress

rake install

Deploying to Github

Create a new Github repository. If you are creating a personal blog create a repo called:

username.github.com

After creating the repo, run the following command.

$rake setup_github_pages

Which is supposed to:

  • init a git repo
  • rename the branch from master to source
  • add your repo to origin.

Running the previous command shows this:

Enter the read/write url for your repository

You have to enter it like this:

git@github.com:username/username.github.com.git

For me it didn’t rename the branch from master to source or add my remote repo. I did it manually (see below)

Add your remote repo

Check what remote repositories you have:

git remote -v

My output was:

octopress   git://github.com/imathis/octopress.git (fetch)
octopress   git://github.com/imathis/octopress.git (push)

To add your repo do:

git remote add origin git@github.com:username/username.github.com.git

Rename the branch from master to source

$git branch
* master
$git branch -m master source
$git branch
* source

Preview on development stage

$ rake preview

Then browse to:

localhost:4000

If you get this error:

Sorry, I cannot find /

Read this link: Deploying to a Subdirectory

First push to Github

$rake generate
$git add .
$git commit -am "First deploy to github." 
$git push origin source
$rake deploy

Create a new posting

$rake new_post["Creating a Github Blog Using Octopress"]

Go to the app folder source/_posts to find the new posting

Edit the posting and then follow these steps

$rake generate
$git add .
$git commit -m "Initial blog post." 
$git push origin source
$rake deploy

Add a custom domain

Go to source folder:

cd source

Create 2 files

CNAME
.nojekyll

Open the CNAMe file and add this line:

www.yourdomain.com

The NoJekyll file will make Octopress works in Github Pages.

Push again to github

rake generate
git add .
git add -am 'domain configuration'
git push origin source
rake deploy

Github needs time to read your CNAME and updating the sites.

Quick Summary for creating and deploying a post in Octopress

$ rake new_post["New Post"]
$ rake generate
$ git add .
$ git commit -am "Some comment here." 
$ git push origin source
$ rake deploy

Disclaimer about this Website

This is not an Octopress website. This is a WordPress website.

I used Octopress for a few years.

The problem with Octopress is that I wanted more customization and didn’t have time for what I wanted to do. Instead I decided to move to WordPress because…(almost) everything is done and you just plug and play.

The best things about an Octopress website are:

  • You write on Vim…the best editor in the Universe.
  • It renders static pages. There is no DB. So it loads ultra fast

Recommendations for a Github Blog

  • Create a private repository in Github
  • Get your domain at DNSimple

Please Post a Comment or Connect with me on Twitter and send me a Tweet


Related Post

Display Post Excerpts in WordPress WordPress is the simplest way to create a website or a blog. I have used Squarespace, Drupal, Octopress and built from scratch. These have their pr...
Go to the Previous Directory in Vim I use Vim. Vim is the most productive text editor if you know some vim commands When I open a file and I am done with it. I often want to go...
Export Data From Firebird Database to CSV File Background Some software applications use a database called Firebird. This is an open source database. If the software application is compiled you ca...
Installing Ruby on Ubuntu Installing Ruby on Ubuntu As seen on RVM... Go to the terminal in Ubuntu. Add the public key from RVM $ gpg --keyserver hkp://keys.gnupg.n...

Leave a Reply