Seven Story Rabbit Hole

Sometimes awesome things happen in deep rabbit holes. Or not.

   images

Octopress Setup Part I

I’m writing this blog entry as I’m creating my blog. I have decided to use Octopress, and I’m initially going to host it on Github Pages.

Step 1: create a github pages repo

In my case, I made a new repo called tleyden/tleyden.github.io.

Step 2: push an index.html

Clone the repo

1
$ git clone git@github.com:tleyden/tleyden.github.io.git

Add some content

1
2
$ cd tleyden.github.io
$ echo "<h1>hello</h1>" > index.html

Commit and push

1
2
3
$ git add index.html
$ git commit -m "empty blog"
$ git push origin master

Step 3: see if it actually worked

Go to http://tleyden.github.io/ to see if it works.

It did not work. WTH!?

Oh wait, it says: It may take up to ten minutes until your page is available.

Patiently hit reload 5 times / minute, and 7 minutes later .. IT WORKS!

Step 4: get rvm (octopress dependency)

1
2
3
$ \curl -L https://get.rvm.io | bash
$ source /Users/traun/.rvm/scripts/rvm
$ rvm notes

Step 5: get ruby 1.9.3 (octopress dependency)

1
2
3
4
5
6
7
8
9
10
$ rvm install 1.9.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p448.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system......
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p448',
please read /Users/traun/.rvm/log/1378534467_ruby-1.9.3-p448/update_system.log
Requirements installation failed with status: 1.

I managed to get past this error by following this stack overflow post. However, the second time I went through these instructions, I got this error which I haven’t figured out yet.

Let’s try this again ..

1
Installing required packages: gcc46, libyaml, libksba, openssl......................................................................................................

45 minutes later, it finally worked.

1
2
$ rvm use 1.9.3
$ rvm rubygems latest

Step 6: get octopress

Follow the Setup Ocotpress instructions

Step 7: recreate repo

So this is a little awkward, and looking back I wish I hadn’t pushed that index.html earlier, because it interferes with the github push in the next step.

  • Delete your entire github repository: username/username.github.io
  • Create a new empty github repository: username/username.github.io

Step 8: deploy to github pages

Follow the Deploy to Github pages instructions.

There is one step that is crucial if you don’t want to accidentally lose your blog content:

1
2
3
git add .
git commit -m 'your message'
git push origin source

After doing that, your github repo should have two branches:

  • Master: the “published blog” goes here, and will have a top-level index.html
  • Source: the entire octopress source tree, plus a “source” and “sass” directory. The “source” directory is where your blog markdown content will actually live.

Step 9: write a blog entry

Follow the New blog post instructions.

Step 10: re-deploy

From the last step in the Deploy to Github pages instructions, do the following:

1
2
$ rake generate
$ rake deploy

NOTE: if you get this error:

1
2
3
cd _deploy
rake aborted!
No such file or directory - _deploy

Then the fix is to git clone the repo into a subdirectory called _deploy (sibling dir of public), and then re-run rake deploy:

1
2
$ git clone git@github.com:tleyden/tleyden.github.io.git _deploy
$ rake deploy

Step 11: revel in it’s beauty

screenshot

Step 12: Oops, don’t forget to push the source changes!

Even though the blog content is deployed (eg, your master branch with your content has been pushed to github), the source is still sitting on your computer. If your hard drive crashes, you’ll lose your markdown, which is no fun.

Here’s how to push the latest changes of your source files up to github:

1
2
3
git add .
git commit -m 'I just added a new blog entry'
git push origin source