经过网络几篇文章整理的大体全面的教程。html
确保安装了git
和ruby1.9.3
,经过brew
安装rbenv
而后用rbenv
安装ruby
。git
先卸载MacPortsgithub
sudo prot -f uninstall installed sudo rm -fr \
再安装brewshell
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz –strip 1 -C /usr/local export PATH=/usr/local/bin:$PATH
安装成功后经过brew install
查看brew版本ubuntu
brew install rbenv brew install ruby-build rbenv install 1.9.3-p0 rbenv rehash
git clone git://github.com/imathis/octopress.git octopress cd octopress gem install bundler rbenv rehash bundle install rake install
编辑 config.yml
文件的url
,title
,subtitle
,author
。浏览器
最好把里面的twitter相关的信息所有删掉,不然因为GFW的缘由,将会形成页面load很慢。同理,修改定制文件/source/_includes/custom/head.html 把google的自定义字体去掉。sass
我如今用的就是greyshade主题 http://www.sgxiang.comruby
cd octopress git clone git@github.com:allenhsu/greyshade.git .themes/greyshade echo "\$greyshade: color;" >> sass/custom/_colors.scss //替换 color 为自定义的连接高亮颜色 rake "install[greyshade]"
在_config.yml中加入markdown
weibo_user: xsxiang # 微博数字 ID 或域名 ID dribbble_user: weibo_share: true # 是否开启微博分享按钮
关于greyshade主题的头像问题,有两种途径能够设置头像
Disqus是octopress内置的comments功能,编辑config.yml
文件能够打开该功能,找到如下内容修改
#Disqus comments disqus_short_name: disqus_show_comment_count: false
填入注册disqus帐号的名称,并将false修改成true。【disqus要和本身的username.github.com关联上】
cd ~/.ssh ssh-keygen -t rsa -C 你注册github时的email
弹出Enter file in which to save the key (/Users/twer/.ssh/id_rsa):
直接按空格
弹出Enter passphrase (empty for no passphrase):
输入你github帐号的密码。Enter same passphrase again:
再次输入你的密码。
打开~/.ssh下的id_rsa.pub文件复制里面的所有内容。
登录github,选择Account Settings-->SSH Public Keys 添加ssh,把剪切板的内容复制到key输入框内直接保存。
测试shh:
ssh git@github.com
输出
PTY allocation request failed on channel 0 Hi username! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
表明成功
登录github建立一个仓库 ,仓库名称为username.github.com好比个人是sgxiang.github.com
利用octopress的一个配置rake任务来自动配置上面建立的仓库:可让咱们方便的部署GitHub page。在终端输入以下命令:
rake setup_github_pages
弹出以后输入git@github.com:your_username/your_username.github.com.git
不要用提示的io,个人是git@github.com/sgxiang/sgxiang.github.com.git
输入如下命令部署博客
rake generate rake deploy
若是没法push到仓库的master分支,尝试在项目目录的.git/config中添加
[branch "master"] remote = origin merge = refs/heads/master
博客的source须要单独提交,执行以下命令就能够将source提交到仓库的source分支下
git add . git commit -m 'Initial source commit' git push origin source
部署前能够在本地预览,输入rake preview
以后在浏览器输入http://localhost:4000/
来访问
经过命令
rake new_post["myTitle"]
文章生成在目录下的source/_posts
目录下。文章是markdown格式的。能够经过 Mou 软件来编辑保存。
关于markdown的格式能够参考这篇文章:http://wowubuntu.com/markdown/
写完后就能够部署更新文章到github上了
rake generate git add . git commit -am "Some comment here." git push origin source rake deploy
参考文章