Hello OctoPress

Post in Octopress

折腾了两天,终于把Blog搭建好了,过程中遇到不少问题,非常感谢twitter上 @lucifr@truthurt@clipppit的热心帮助。

"Octopress"

总结一些过程中的问题主要有以下几点,希望在今后大家搭建的过程中有所帮助。

1.安装RVM

1
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Next add RVM to your shell as a function.

1
2
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile

PS.最好改一下配置文件,在主文件夹下边的 .bashrc文件,在最后加一行代码

1
2
# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Install Ruby 1.9.2 and ensure RVM has the latest RubyGems.

1
2
rvm install 1.9.2 && rvm use 1.9.2
rvm rubygems latest

2.安装Octopress

install Octopress
1
2
3
4
5
6
7
8
9
git clone git://github.com/imathis/octopress.git octopress
cd octopress    # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version  # Should report Ruby 1.9.2

gem install bundler
rbenv rehash    # If you use rbenv, rehash to be able to run the bundle command
bundle install

rake install

3.部署

申请一个你用户名命名的仓库地址,就像这样username.github.com,然后在终端里执行

1
rake setup_github_pages

然后让你输入一个地址,这样,用户名当然得换了,注意大小写。

1
git@github.com:username/username.github.com.git

静态化代码,部署

1
2
rake generate
rake deploy

提交到source分支

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

原则很简单,只要记住your_local_octopress_directory对应的的remote source branch,而_deploy对应的是remote master branch即可。

4.第三方主题

Octopress Wiki Theme List

install new theme
1
2
3
4
$ cd octopress
$ git clone theme-git-url .themes/theme_name
$ rake install['theme_name']
$ rake generate

使用 zsh 時發生問題嗎?試試看rake install\['theme_name'\]