庇护祝福的分享

Be worthy

Github+octopress创建自己的博客

添加SSH公钥

$ cd ~/.ssh
$ ssh-keygen -t rsa -C "your_email@example.com"
将id_rsa.pub文件中的公钥copy到github上
$ ssh -T git@github.com #测试是否通过。

新建仓库

在github上新建一个仓库,命名为 yourname.github.com

本地安装octopress

$ git clone git://github.com/imathis/octopress.git octopress #下载octopress
$ cd octopress
$ bundle install 
$ rake install #安装默认主题

配置

编辑_config.yml文件配置博客名,扉页等
编辑config.rb文件配置css,图片路径等

编辑,上传

$ rake new_post["my first blog"] #新建blog
创建以后会在/source/_post目录下创建一个时间戳开头的文件,编辑这个文件撰写博客. 如果无法执行可以先输入:
$ alias rake="noglob rake"

$ rake setup_github_pages #配置本地与github连接
根据提示操作即可

$ rake generate #项目静态化
将配置修改,和编辑过的内容导入public中,window下控制台编码默认为GBK,需要在cmd下使用命令: chcp 65001将控制台代码格式转为utf-8

$ rake preview #预览
可以使用http://localhost:4000预览

$ rake deploy #上传