使用github+octopress搭建个人技术博客


1. git clone git://github.com/imathis/octopress.git octopress


2.
cd octopress
gem install bundler
bundle install

3.

登录Github,假设你的用户名是username,首先要新建一个命名为 username.github.com 的Repo,命名必须是这个格式,如果不这样命名的话,在运行命令 rake setup_github_pages 之后不能够自动创建后面提到的master和source 分支,而是作为普通仓库生成 gh-pages 分支。

xiongzenghuigithub.github.com


4. 发布Octopress到Github

rake setup_github_pages
输入刚才创建的代码仓库的ssh地址

rake install
rake generate
rake preview

将博客发布到Github上
rake deploy


5.
别忘了把所有源文件发布到 source 分支下面:

git add .
git commit -m “your message”
git push origin source


6.
url: http://username.github.com # 博客地址
title: 蔓草札记 # 博客标题
subtitle: 感受生活,感悟工作,感触心灵 # 副标题
author: xhhjin # 作者
simple_search: http://www.google.com.hk/search # 搜索引擎
description: # 关于博客的描述
subscribe_rss: /atom.xml # Rss订阅地址, 默认是 /atom.xml
subscribe_email: # 提供Email订阅的地址
email: # Rss订阅的Email地址
root: / # 博客路径,默认是“/“,如果你打算在子目录中,记得修改这个路径
permalink: /blog/:year/:month/:day/:title/ # 文章的固定链接形式

 

在本机创建ssh

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

 


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
git add .
git commit -am "Some comment here."
git push origin source
rake deploy

posted on 2015-08-09 17:38  ZainH  阅读(229)  评论(0)    收藏  举报