Even though Octopres uses Jekyll for generating pages it’s layout and the way they expect you to use it with Github Pages is actually quite different. This is my recipe for migrating:
Now with Jekyll-Bootstrap your directory structure probably looks something like this:
1 2 3 4 5
Your site and the Jekyll code are interwoven. You probably have it all on one branch, and when you push you push the entire thing.
This is not the case with the standard Octopress layout. It looks more like this:
1 2 3 4 5 6
Everything you see here with the exception of the
_deploy folder (which is listed in the
.gitignore will be kept on a
source branch in git. The contents of the
_deploy folder will be your production branch. Almost all of your work will go into the
In order to get to the right state we are going to be a little sneaky as we move things around.
You will need at least version 1.9.3 of ruby. If you don’t have it yet I suggest installing RVM.
After installing make sure you have 1.9.3 like this:
1 2 3
The old switcheroo
OK, so what we need to do now in order to get everything into the right place is to move the “main” directory into a branch and keep the master in a subdirectory.
So first make a backup copy of our current state. and then go into the original.
next we need to make a
source branch where our Jekyll is going to live. After doing that delete all of the content from the branch.
1 2 3 4 5
Next we are going to get the octopress content and copy it into our directory without the git history.
1 2 3 4 5 6 7
Now lets make sure we have a working octopress directory. When you CD’d into the dir rvm probably asked you if you want to trust the rvmc file. Do so. Now set up the app:
1 2 3 4
Now we are going to clone your original master branch into the
_deploy dir. Yes this is kind of weird. The outer directory will be on the
source branch and the
_deploy dir will be on the
This is the hard part. Copy your content over from the
/_deploy directory to the
/source directory. This is not going to be an exact science. Take a look at what you’ve got and migrate as neccessary. Your milage may vary.
You can probably get 90% of what you need with these two:
The _config.yml file
The two config files are a bit different. You can’t just copy the boostrap file over so open them both and copy the individual settings over that you need.
Run the site and check it out. Make sure everything is what you want it to be. When you do a
preview Jekyll will place your files in the
public directory (which is also ignored by git)
Before you do this check the Octopress rake file and change the
deploy_default method to “push”. You will find it in a section at the top that looks like this;
1 2 3 4 5 6 7 8
Now we are going to replace your old site with the new site (at last!)
We need to clear out all of the files on the master branch to make way for the new content.
1 2 3 4 5
When you do the deploy it’s going to:
- generate the site and place the contents into the
_deploydirectory (your master branch)
- add and commit everything present to git’s origin master.
- push the master branch to github.
Last don’t forget to push your source branch to github!