Refer to this link
开始之前的准备工作:安装Git、ruby、bundler。
准备
下载octopress:
git clone git://github.com/imathis/octopress.git octopress
进入octopress目录,执行
rake install
创建部署
创建一个新的Github的空repo,并且命名为iamshijie.github.io
进入自己下载的octopress的目录并执行
rake setup_github_pages
。当提示输入repo地址时,输入上一步创建的git地址:git@github.com:Shi-Jie/iamshijie.github.io.git
继续在octopress目录下执行
rake generate
。此时,打开http://iamshijie.github.io.git就能看到blog原型。再执行rake deploy
git提交。本别执行
git add .
、git commit -m 'your message'
、git push origin source
修改个人blog的默认分支为source,而非master git link
创建博客
这部分可以参考之前在QA community的blog。
clone博客repo到本地:
git clone git@github.com:iamshijie/iamshijie.github.io.git
确保你的默认分支是source。即
git status
后看到的是Shi-Jie:iamshijie.github.io shijie$ git status On branch source Your branch is up-to-date with 'origin/source'. nothing to commit, working directory clean
本地生成发布目录,执行
rake setup_github_pages
交互时输入git@github.com:Shi-Jie/iamshijie.github.io.git
执行
rake install
。安装默认主题。创建新post。在repo下执行
rake new_post["How to create blog with octopress"]
修改上一步生成的markdown文件,直接在默认生成的内容后进行添加编辑:
--- layout: post title: "How to setup blog with octopress" date: 2015-01-21 09:16:24 +0800 comments: true categories: ---
使用
rake preview
进行预览确认无误后。使用
rake gen_deploy
发布的master。完成后,就可以在个人http://iamshijie.github.io看到效果将改动提交到source分支
git add . git commit -m 'Post my first blog. - ShiJie' git push