This blog post covers how recreate a local repository of your Octopress blog. I needed to figure out how to do this so that I could update my blog from both my personal desktop and my laptop.
Note: This solution will only work with the 2.x version of Octopress. For the 3.x version there’s Octopress Deploy
How Octopress Works
Octopress repositories have two branches,
master. The source
branch contains the files that are used to generate the blog and the
contains the blog itself.
When the local folders are initially configured according to the Octopress Setup
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
Recreating an Octopress repository
To recreate the local directory structure of an existing Octopress blog, follow these instructions.
First you will need to clone the
source branch to a local octopress folder.
$ git clone -b source email@example.com:username/username.github.com.git octopress
Then clone the
master branch to the
$ cd octopress $ git clone firstname.lastname@example.org:username/username.github.com.git _deploy
Then run the rake installation to configure everything
$ 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, 'email@example.com:your_username/your_username.github.com)
You are now setup with a new local copy of your existing 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 second machine, you will need to pull down those changes.
$ cd octopress $ git pull origin source # update the local source branch $ cd ./_deploy $ git pull origin master # update the local master branch