多台mac公用octorpess
2015-08-10 10:59
423 查看
一、Octopress目录结构
Octopress的仓库目录下有两个branch,source和
master。
source分支下保存Octopress的源代码,我们需要用他们生成博客,该分支保存在Octopress本地仓库的根目录下;
master分支下保存生成的博客内容,该分支在Octopress本地仓库的根目录下一个叫
_deploy得文件夹中。该文件夹是以下划线开头的,会在执行
git push origin source命令时被忽略,这也是为什么一个目录中能同时存在两个不同分支的文件夹的原因。
二、在本地重建Octopress仓库
需要执行以下命令:clone
source分支
$ git clone -b source git@github.com:username/username.github.com.git octopress |
username替换成你自己github用户名。 另外还要注意的是,clone的地址不能是
http而必须得是
ssh的。
如果执行时提示以下错误:
Cloning into 'octopress'... The authenticity of host 'github.com (192.30.252.131)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. |
ssh key并添加到github中。
这是你需要执行2; 如果没出现上述错误,直接执行3。
2.创建并添加ssh key
2.1 创建ssh key
2.1.1 生成key
执行命令:
$ ssh-keygen -t rsa -C "your_email@example.com" |
Generating public/private rsa key pair. Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter] |
Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again] |
接下来会提示:
Your identification has been saved in /Users/you/.ssh/id_rsa. # Your public key has been saved in /Users/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com |
2.1.2 把生成的key添加到
ssh-agent中 最后需要执行以下命令:
$ ssh-add ~/.ssh/id_rsa |
2.2.1 copy key内容
先执行下面的命令:
pbcopy < ~/.ssh/id_rsa.pub |
2.2.2 找到添加key的地方
先点击 Account Settings :
进入设置界面后,点击界面左侧的 SSH KEYS :
点击
Add SSH key按钮:
点击
Add key按钮:
在输入框内粘贴刚才copy的key,点击确定即可。
2.3 验证key可用性
通过ssh github验证key是否可用:
$ ssh -T git@github.com |
The authenticity of host 'github.com (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? |
yes如果打印以下内容,就说明OK了:
Hi username! You've successfully authenticated, but GitHub does not |
下面需要将master分支clone到
_deploy目录:
$ cd octopress $ git clone git@github.com:username/username.github.com.git _deploy |
执行以下命令配置环境:
$ gem install bundler $ rbenv rehash # If you use rbenv, rehash to be able to run the bundle command $ bundle install $ rake setup_github_pages |
Enter the read/write url for your repository (For example, 'git@github.com:your_username/your_username.github.com) |
三、Tips
及时提交本地修改在每处配置了Octopress的地方,做了任何修改都要提交,否则另一个地方做了修改,本地更新的时候肯定会冲突。
每次在本地做完修改以后,都要及时提交,分别执行以下命令:
$ rake generate $ rake deploy # update the remote master branch |
Octopress根目录下的
public/目录下;
第二条命令主要做了两件事:
*用
generate命令生成在
public/目录下的内容覆盖
_deploy/目录下内容;
*将
_deploy/目录下的修改
add、
commit到git,并
push到git的
master分支。
别以为这就结束了,你还得把source分支中做的修改提交的git仓库中,执行以下命令:
$ git add . $ git commit -am "Some comment here." $ git push origin source # update the remote source branch |
2.修改前先更新到最新版本
为了以防万一,在本地做任何修改前都要先做更新,可以执行以下命令分别更新
source和
master分支:
$ cd octopress $ git pull origin source # update the local source branch $ cd ./_deploy $ git pull origin master # update the local master branch |
相关文章推荐
- Axis2开发webservice详解
- LCS 最大公共序列算法
- IOS等待时动画效果的实现
- C++ 堆排序算法
- 积跬步,聚小流------Bootstrap学习记录(1)
- Java实现数据结构之二叉查找树
- 报错为未启用当前数据库的 SQL Server Service Broker,请为此数据库启用 Service Broker
- 计算天数
- 练字心得
- poj 1458 Common Subsequence
- SQL删除所有重复数据。
- win7下编译python源码
- vs2015/mfc动态创建菜单
- java.io.IOException: Too many open files
- POJ 2955 Brackets
- 4.6向左或向右 ---RadioGroup组与onCheckedChanged事件
- 用户控件使用ViewState
- Linux下搭建Android开发环境
- js绑定事件方法:addEventListener与attachEvent的不同浏览器的兼容性写法
- 人脑理解递归