Blog 1

Random Talk on Random Thoughts

Using Octopress on Another Device

| Comments |

Two days ago, my Linux desktop was down. As a result, I had to use a laptop that ran on Windows 7 to browse the web. I wasn’t sure how long it’d take to fix the desktop, so I tried installing Octopress on Windows 7.

I mainly followed the tutorial on Simple Tutorial Blog. If my blog consists merely of simple passages, the tutorial should have worked for me. Unluckily, if any page/post contains a code block, then Pygment, which depends on Python, is used. Tony Jan described how he solved the problem of RubyPython in details.1 I have no knowledge in Ruby and Python programming, so I don’t think that I can find out what’s wrong like him. Fortunately, I didn’t encounter his error.

However, when I was setting up Octopress on Windows 7, I’ve learned something that I’d like to write it down.

Additional notes on the prerequisite packages

In the section Before You Begin of the tutorial, it’s said that three packages are needed:

  1. Git
  2. RubyInstaller for Windows (version 1.9.3)
  3. Ruby Development Kit (the one “for use with Ruby…1.9.3”)


Apart from just installing Git on Windows, you may also choose “Run Git from the Windows Command Prompt”.

Source: The Geek Stuff

  • If you “use Git Bash only”, then you can only run git from Git Bash icon, instead of the Windows Command Prompt.

  • As described by the text under the second option, there’s only one difference between the first and the second option.

    Only Git will be added to your PATH.

    This enables other programs to make use of Git. For example, Tim Pope’s fugitive.vim, which is a Vim plugin for using Git within the editor, can be used in gVim on Windows after Git’s absolute path is appended to the PATH variable.

When I installed Git on Windows half a year ago, I didn’t pay much attention to the text under each option, and I chose the default option (i.e. the first one). Then I used it happily for the last six months.

At first, I’m not sure if I have to run git from the Windows Command Prompt for setting Octopress up on Windows. Therefore, I tried seeking ways to run Git from the Windows Command Prompt, and found a question on Stack Overflow which was exactly my question, and the right solution is to add C:\Program Files\Git\cmd to the PATH variable via GUI (“Start” → “Computer” → “Properties” → “Advanced” → “Environment Variables”).


Just downloading and installing the two packages will do. However, I regret clicking the buttons too quick. After I’d already installed Ruby 1.9.3 without changing the installer’s default options, I thought that the checkbox “Tcl/Tk support” should also be checked.

I feared that I would eventually get some extremely unusual errors if I continued without Tcl/Tk support. Therefore, I decided to get the support by whatever way. By trial, double-clicking the same installer and using the same destination file for the Ruby installation (that is, C:\Ruby193) worked for me.

For the third package, to save time, I just checked every square boxes I could see.

Remaining steps for setting up a new blog

Following the guidances of the tutorial should be OK. However, if you have an existing Octopress blog and you’d like to post contents onto it using your new computer, Scott Cheng has provided detailed instructions in his post.2 Unluckily, I failed to understand point 5 in his post, and got some errors.3

Now, I still don’t understand why the master branch needs to be deleted after I cloned the repository from GitHub, and I can’t remember why the master branch generated by rake deploy was “behind” the remote master branch.

My way to write Octopress blog from multiple repositories

Raison d’être

One key function of a Git repository is to allow users to collaborate on the same project effectively. It’s insensitive to avoid cloning a Git repository and to work in a single folder only. Since Git is used as an SCM for Octopress, finding an approach for cross-platform blogging is a meaningful question to general bloggers and Git users.

Actual procedures of the solution

In order to post contents to the same Octopress repository, both the source branch and the master branch, which is contained in /_deploy, will be kept up to date with the remote repository.

I copied the four commands from Robert Anderson’s post.

$ cd octopress
$ git pull origin source  # update the local `source' branch
$ cd _deploy
$ git pull origin master  # update the local `master' branch

  1. 在 Windows 使用 Octopress in 不歸錄.

  2. The link is now dead. See his Markdown source file in GitHub instead.

  3. I can now understand point 5 in Scott Cheng’s post. See my newer post for details. (Last added on SEP 6, 2014)