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
|
|
Add some content
1 2 |
|
Commit and push
1 2 3 |
|
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 |
|
Step 5: get ruby 1.9.3 (octopress dependency)
1 2 3 4 5 6 7 8 9 10 |
|
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
|
|
45 minutes later, it finally worked.
1 2 |
|
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 |
|
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 |
|
NOTE: if you get this error:
1 2 3 |
|
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 |
|
Step 11: revel in it’s beauty
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 |
|