How to Setup Octopress on Github Pages
As mentioned in the previous post, I have switched from Wordpress to Octopress. This post, I am writing the steps on how I get it running.
You need to install Git and Ruby 1.9.3. As Octopress must use Ruby 1.9.3, if
ruby --version does not give you 1.9.3, then you must install via rbenv.
Follow the guide for rbenv. Do the standard method if you have Mac Ports installed (cos it will conflict with Homebrew).
If you are using Mac, you will need to download and install OSX GCC Compiler because Apple no longer includes that, and Ruby needs that.
An exception for me is that I installed p194 instead of p0. You might need other post revisions.
# Here's how I found out rake new_post["Switched Wordpress to Octopress"] rbenv: version `1.9.3-p194' is not installed # Hence.. rbenv install 1.9.3-p194 rbenv global 1.9.3-p194
With Ruby 1.9.3, setup octopress.
gem install bundler rbenv rehash bundle install
It is interesting to notice that
rake setup_github_pages does 2 things:
- master branch is your _deploy directory (the static html)
- source branch contains the project less _deploy (the markdowns, config and plugins)
rake generate rake deploy
rake deploy will commit and push up to the master branch. In a few minutes, Github will be serving those webpages (it takes longer for the first time).
So what about the source branch? You should also commit and push them.
git add . git commit -m 'your message' git push origin source
I am using my custom domain samwize.just2us.com, instead of samwize.github.com. This can be accomplished easily be adding a CNAME file.
echo 'your-domain.com' >> source/CNAME
Then setup your DNS. For myself, I added a new CNAME record
samwize.just2us.com pointing to
If you are using a Top-level domain, add a A record pointing to
This is my process whenever I have a new blog post.
rake new_post["My New Post"] # edit my-new-post.markdown with text editor rake preview # Open http://localhost:4000 for a preview # Edit and preview until satified # Ready to publish rake generate rake deploy # Commit source git add . git commit -m 'your message' git push origin source