Skip to content

Instantly share code, notes, and snippets.

@liuyix
Last active December 20, 2015 06:58
Show Gist options
  • Select an option

  • Save liuyix/6089460 to your computer and use it in GitHub Desktop.

Select an option

Save liuyix/6089460 to your computer and use it in GitHub Desktop.
octopress different places

Credit: Clone Your Octopress to Blog From Two Places

原理

每个octopress建立的静态站点的结构是(假定octopress目录为 $octopress):

  • $octopress 是 username.github.com的source分支
  • $octopress/_deploy 是 username.github.com的master分支

部署步骤

  1. $ git clone -b source git@github.com:username/username.github.com.git octopress
cd octopress
git clone git@github.com:username/username.github.com.git _deploy 
  1. install octopress environment
gem install bundler
rbenv rehash    # If you use rbenv, rehash to be able to run the bundle command
bundle install
rake setup_github_pages

注意事项

当你在一处更改了username.github.com的源代码,若想在其他地方继续更改则需要将修改push到source分支,然后在另一处pull出来继续修改。

在A处编写了新的blog

rake generate
git add .
git commit -am "Some comment here." 
git push origin source  # update the remote source branch 
rake deploy             # update the remote master branch

在B处继续修改前

cd octopress
git pull origin source  # update the local source branch
cd ./_deploy
git pull origin master  # update the local master branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment