GitHub Pages+Octopressでブログを構築しよう！

[GitHub Pages](http://pages.github.com/)+[Octopress](http://octopress.org/)でブログを構築する手順を、備忘録的にメモしておこう。

## 前提条件
Ruby1.9.3+RVMの環境で構築します。

## Octopressインストール

基本的な手順は、[Octopress Setup](http://octopress.org/docs/setup/)と同様です。

```bash
$ git clone git://github.com/imathis/octopress.git fakestarbaby.github.com
Cloning into fakestarbaby.github.com...
remote: Counting objects: 6310, done.
remote: Compressing objects: 100% (2340/2340), done.
remote: Total 6310 (delta 3593), reused 5890 (delta 3404)
Receiving objects: 100% (6310/6310), 1.28 MiB | 141 KiB/s, done.
Resolving deltas: 100% (3593/3593), done.
$ cd fakestarbaby.github.com
$ bundle install
Fetching gem metadata from http://rubygems.org/.......
Installing rake (0.9.2) 
Installing RedCloth (4.2.8) with native extensions 
Installing posix-spawn (0.3.6) with native extensions 
Installing albino (1.3.3) 
Installing blankslate (2.1.2.4) 
Installing chunky_png (1.2.1) 
Installing fast-stemmer (1.0.0) with native extensions 
Installing classifier (1.3.3) 
Installing fssm (0.2.7) 
Installing sass (3.1.5) 
Installing compass (0.11.5) 
Installing directory_watcher (1.4.0) 
Installing ffi (1.0.9) with native extensions 
Installing haml (3.1.2) 
Installing kramdown (0.13.3) 
Installing liquid (2.2.2) 
Installing syntax (1.0.0) 
Installing maruku (0.6.0) 
Installing jekyll (0.11.0) 
Installing rubypython (0.5.1) 
Installing pygments.rb (0.1.3) 
Installing rack (1.3.2) 
Installing rb-fsevent (0.4.3.1) with native extensions 
Installing rdiscount (1.6.8) with native extensions 
Installing rubypants (0.2.0) 
Installing tilt (1.3.2) 
Installing sinatra (1.2.6) 
Installing stringex (1.3.0) 
Using bundler (1.1.3) 
$ rake install
## Copying classic theme into ./source and ./sass
```

ここまでで、Octopressのインストールは終了。
簡単ですね。

## GitHub Pagesデプロイ

基本的な手順は、[Deploying to Github Pages](http://octopress.org/docs/deploying/github/)と同様です。
"username.github.com" のリポジトリを事前に準備しておこう。

```bash
$ rake setup_github_pages
Enter the read/write url for your repository: git@github.com:FakeStarBaby/fakestarbaby.github.com.git
Added remote git@github.com:FakeStarBaby/fakestarbaby.github.com.git as origin
Set origin as default remote
Master branch renamed to 'source' for committing your blog source files
Initialized empty Git repository in /Users/fakestarbaby/Projects/rails/fakestarbaby.github.com/_deploy/.git/
[master (root-commit) c4f6f65] Octopress init
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 index.html

---
## Now you can deploy to http://FakeStarBaby.github.com with `rake deploy` ##
$ rake generate
## Generating Site with Jekyll
directory source/stylesheets/ 
   create source/stylesheets/screen.css 
/Users/fakestarbaby/.rvm/gems/ruby-1.9.3-p0@fakestarbaby.github.com/gems/maruku-0.6.0/lib/maruku/input/parse_doc.rb:22:in `<top (required)>': iconv will be deprecated in the future, use String#encode instead.
Configuration from /Users/fakestarbaby/Projects/rails/fakestarbaby.github.com/_config.yml
/Users/fakestarbaby/.rvm/gems/ruby-1.9.3-p0@fakestarbaby.github.com/gems/ffi-1.0.9/lib/ffi/platform.rb:27: Use RbConfig instead of obsolete and deprecated Config.
Building site: source -> public
Successfully generated site: source -> public
$ rake deploy
## Deploying branch to Github Pages 

## copying public to _deploy

## Commiting: Site updated at 2012-03-28 00:55:54 UTC
[master 870d0ea] Site updated at 2012-03-28 00:55:54 UTC
 61 files changed, 2658 insertions(+), 1 deletions(-)
 create mode 100644 assets/jwplayer/glow/controlbar/background.png
 create mode 100644 assets/jwplayer/glow/controlbar/blankButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/divider.png
 create mode 100644 assets/jwplayer/glow/controlbar/fullscreenButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/fullscreenButtonOver.png
 create mode 100644 assets/jwplayer/glow/controlbar/muteButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/muteButtonOver.png
 create mode 100644 assets/jwplayer/glow/controlbar/normalscreenButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/normalscreenButtonOver.png
 create mode 100644 assets/jwplayer/glow/controlbar/pauseButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/pauseButtonOver.png
 create mode 100644 assets/jwplayer/glow/controlbar/playButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/playButtonOver.png
 create mode 100644 assets/jwplayer/glow/controlbar/timeSliderBuffer.png
 create mode 100644 assets/jwplayer/glow/controlbar/timeSliderCapLeft.png
 create mode 100644 assets/jwplayer/glow/controlbar/timeSliderCapRight.png
 create mode 100644 assets/jwplayer/glow/controlbar/timeSliderProgress.png
 create mode 100644 assets/jwplayer/glow/controlbar/timeSliderRail.png
 create mode 100644 assets/jwplayer/glow/controlbar/unmuteButton.png
 create mode 100644 assets/jwplayer/glow/controlbar/unmuteButtonOver.png
 create mode 100644 assets/jwplayer/glow/display/background.png
 create mode 100644 assets/jwplayer/glow/display/bufferIcon.png
 create mode 100644 assets/jwplayer/glow/display/muteIcon.png
 create mode 100644 assets/jwplayer/glow/display/playIcon.png
 create mode 100644 assets/jwplayer/glow/dock/button.png
 create mode 100644 assets/jwplayer/glow/glow.xml
 create mode 100644 assets/jwplayer/glow/playlist/item.png
 create mode 100644 assets/jwplayer/glow/playlist/itemOver.png
 create mode 100644 assets/jwplayer/glow/playlist/sliderCapBottom.png
 create mode 100644 assets/jwplayer/glow/playlist/sliderCapTop.png
 create mode 100644 assets/jwplayer/glow/playlist/sliderRail.png
 create mode 100644 assets/jwplayer/glow/playlist/sliderThumb.png
 create mode 100644 assets/jwplayer/glow/sharing/embedIcon.png
 create mode 100644 assets/jwplayer/glow/sharing/embedScreen.png
 create mode 100644 assets/jwplayer/glow/sharing/shareIcon.png
 create mode 100644 assets/jwplayer/glow/sharing/shareScreen.png
 create mode 100644 assets/jwplayer/player.swf
 create mode 100644 atom.xml
 create mode 100644 blog/archives/index.html
 create mode 100644 favicon.png
 create mode 100644 images/bird_32_gray.png
 create mode 100644 images/bird_32_gray_fail.png
 create mode 100644 images/code_bg.png
 create mode 100644 images/dotted-border.png
 create mode 100644 images/email.png
 create mode 100644 images/line-tile.png
 create mode 100644 images/noise.png
 create mode 100644 images/rss.png
 create mode 100644 images/search.png
 rewrite index.html (100%)
 create mode 100644 javascripts/ender.js
 create mode 100644 javascripts/github.js
 create mode 100644 javascripts/libs/ender.js
 create mode 100644 javascripts/libs/jXHR.js
 create mode 100644 javascripts/libs/swfobject-dynamic.js
 create mode 100644 javascripts/modernizr-2.0.js
 create mode 100644 javascripts/octopress.js
 create mode 100644 javascripts/pinboard.js
 create mode 100644 javascripts/twitter.js
 create mode 100644 sitemap.xml
 create mode 100644 stylesheets/screen.css

## Pushing generated _deploy website
Counting objects: 79, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (72/72), done.
Writing objects: 100% (79/79), 179.59 KiB, done.
Total 79 (delta 1), reused 0 (delta 0)
To git@github.com:FakeStarBaby/fakestarbaby.github.com.git
 + 0446c06...870d0ea master -> master (forced update)

## Github Pages deploy complete
```

"http://username.github.com/" へアクセスし、GitHub Pagesが作成された事を確認しよう。
無事に空っぽのブログが表示されれば問題無し。

## GitHubコミット

最後に、ここまでのソースコードをGitHubのリポジトリへコミットするのをお忘れなく。

```bash
$ git add .
$ git commit -m "Initial commit."
$ git push
```

無事にコミット出来たようですね。

***

それでは、ブログを始めようか！