A good blogging system must support users to easily start composing and publishing from multiple devices. However, the Octopress website only teaches how to create a fresh blog, but talks nothing about setting up an existing blog on a fresh computer. This operation turned out to be somewhat confusing to me, and obviously I’m not alone on this. So here I record the process, partly for my later reference, partly in hope to help others.
Here is a context: I’m using GitHub user pages (scottcheng.github.com) to host my Octopress blog, so this walk-through may or may not apply to your case. It shouldn’t be too far off, though.
- Clone your old blog repo with all your previous posts in it (instead of a fresh Octopress repo).
- Unless you changed the repo’s default branch, you now have the master branch containing the static site. In this case, use
git checkout source
to grab the source files. - Install the dependencies if you haven’t yet.
- Run
rake setup_github_pages
, and Octopress will point your generated site (in _deploy folder) to the master branch – you can deploy now. - Remove master branch locally with
git branch -d master
. Otherwise, every time you dogit push
, git will alert conflicts on the master branch.- Alternative 1:
git push origin source
all the time. - Alternative 2: use
git config push.default current
to only push the current branch (i.e. source branch) by default ingit push
.
- Alternative 1:
- Start blogging!
Be a happy owner of your new machine, and don’t let Octopress get in the way ;)