- 建立公钥私钥
在/Users/xujiaqi/.ssh找到id_rsa.pub文件,打记事本打开将其中全部内容复制,粘贴到github或gitcafe的SSH管理里面。
检查是否可以连接到github或gitcafe
1
2
3
| ssh -T git@github.com
或
ssh -T git@gitcafe.com
|
连接成功:
1
| Hi coderJackie! You've successfully authenticated, but GitCafe does not provide shell access.
|
- 将博客的源文件clone到本地的octopress文件夹内。
1
| xujiaqideMac-mini:octopress xujiaqi$ git clone -b source git@github.com:CoderJackie/coderjackie.github.com.git octopress
|
- 将博客文件clone到octopress的_deploy文件夹内。
1
2
| xujiaqideMac-mini:octopress xujiaqi$ cd octopress
xujiaqideMac-mini:octopress xujiaqi$ git clone git@github.com:CoderJackie/coderjackie.github.com.git _deploy
|
- 安装bundler,rake,如安装过则不需要
1
2
3
4
| cd octopress
sudo gem install bundler
bundle install
rake install (不需要,会覆盖掉原来的主题)
|
- 最后就可以在这台电脑上写博客了
1
| rake new_post["myBlog"]
|
- 编写完博客要上传到github
1
2
3
4
5
| rake generate
git add .
git commit -m "Some comment here."
git push origin source
rake deploy
|
- 如果无法push到仓库的master分支,尝试在项目目录的.git/config中添加
1
2
3
| [branch "master"]
remote = origin
merge = refs/heads/master
|
**为防止多台电脑编辑,每次编写前先要pull一下**
1
2
3
4
| $ cd octopress
$ git pull origin source # update the local source branch
$ cd ./_deploy
$ git pull origin master # update the local master branch
|