Setting Up Octopress Blog Once You Lost the Working Env
by Ashwani Kumar
So recently I wanted to revisit my blog after a long long break, and I realized that my working blogging environment broke and I wanted to setup again to be able to blog from both my personal laptop and any other laptop. But to my dismay, it was not that stright forward. Luckily, I had the source folder of my blog with me. It was quite a feat, Hence I thought of documenting it through this post.
How Octopress works
Octopress repositories have two branches, source and master. The source branch contains the files that are used to generate the blog and the master contains the blog itself.
When the local folders are initially configured according to the Octopress Setup Guide, the master branch is stored in a subfolder named ‘_deploy’. Since the folder name begins with an underscore, it is ignored when you git push origin source. Instead, the master branch (which contains your blog posts) gets updated when you rake deploy.
Clone your blog to the new machine
$ git clone -b source firstname.lastname@example.org:username/username.github.com.git Local_octopress
$ cd Local_octopress
$ git clone email@example.com:username/username.github.com.git _deploy
$ gem install bundler
$ rbenv rehash # If you use rbenv, rehash to be able to run the bundle command
$ bundle install
$ rake setup_github_pages
It will prompt you for your repository URL.
Enter the read/write url for your repository
(For example, 'firstname.lastname@example.org:your_username/your_username.github.com)
That’s you setup with a new local copy of your Octopress blog.
Pushing changes from two different machines
If you want to blog from more than one computer, you need to make sure that you push everything before switching computers.
From the first machine do the following whenever you’ve made changes:
$ rake generate
$ git add .
$ git commit -am "Some comment here."
$ git push origin source # update the remote source branch
$ rake deploy # update the remote master branch
Then on the other machine, you need to pull those changes.
$ cd octopress
$ git pull origin source # update the local source branch
$ cd ./_deploy
$ git pull origin master # update the local master branch
If you were returning to blogging after so long, chances are that there were many things changed.
Rubypants is removed.
Include Code Tag lets you embed external code snippets from your file system and adds a download link
Pullquote Tag Generate beautiful semantic pullquotes (no double data) based on Maykel Loomans's technique
Category Generator gives you archive pages for each category
Sitemap.xml Generator for search engines
I got so many errors once I checked out a new version of Octopress. It was not supporting many of my old plugins, So I got rid of some, and I updated some.
Another error was Updates were rejected because the tip of your current branch is behind when I executed "bundle exec rake gen_deploy"
The reason is that Octopress only does a push to the master branch and not a pull. To resolve this, do this:
$$ cd _deploy
$$ git push origin master -f # hope this solves the problem, move to next command
$$ cd ..
$$ bundle exec rake gen_deploy
Another error was in installing curl on windows. So I had to refer this
And install curb manually.
C:\Users\AshwaniK> gem install curb -v '0.7.18' -- --with-curl-lib=C:\libcurl\bin --with-curl-include=C:\libcurl\include
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-curl-lib=C:\libcurl\bin --with-curl-include=C:\libcurl\include'
This could take a while...
Successfully installed curb-0.7.18
Installing ri documentation for curb-0.7.18
1 gem installed