Octopress documention can be quite confusing. It took me a while to understand what the heck Octopress is doing to branches and remote origins. It actually pretty simple, so I am going to try to un-confuse you. I will also show you a better way to contribute to an existing blog and explain what’s happening in those Rake tasks.
Next, fetch Octopress and install it locally. This gets the files from its main repository and applies a default theme.
$ git clone git://github.com/imathis/octopress.git octopress
Cloning into octopress...
remote: Counting objects: 6046, done.
remote: Compressing objects: 100% (2420/2420), done.
remote: Total 6046 (delta 3448), reused 5549 (delta 3097)Receiving objects: 100% (6046/6046), 1.26 MiB | 426 KiB/s, done.
Resolving deltas: 100% (3448/3448), done.
$ cd octopress
octopress$ bundle install
Fetching source index for http://rubygems.org/
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
octopress$ rake install
## Copying classic theme into ./source and ./sass
octopress$ rake setup_github_pages
Enter the read/write url for your repository: firstname.lastname@example.org:username/username.github.com.git
Added remote email@example.com:username/username.github.com.git as origin
Set origin as default remote
Master branch renamed to 'source'for committing your blog source files
Initialized empty Git repository in /home/username/source/octopress/_deploy/.git/
[master (root-commit) 2a4e9e7] Octopress init
1 files changed, 1 insertions(+), 0 deletions(-)create mode 100644 index.html
## Now you can deploy to http://username.github.com with `rake deploy` ##
So what the heck happened here? It pointed our clone to our new repository. It also created a _deploy directory with another git repository that is going to contain everything that is being deployed. The remote in that directory is the same as the one in our octopress directory, but the checked out branch is master. Btw, we’re now on the source branch.
octopress$ rake new_post["New Post"]Creating new post: source/_posts/2012-01-17-new-post.markdown
Edit the generated file and add some text at the bottom. Generate the blog.
octopress$ rake generate
## Generating Site with Jekylldirectory source/stylesheets/
Configuration from /home/dblock/source/o/octopress/_config.yml
Building site: source -> public
Successfully generated site: source -> public
You can also preview it with rake preview.Before we deploy the blog, save the source and push it to Github. Note that we’re pushing our source branch.
You’ll have to do this every time you want to deploy your changes.So how does one start contributing to an existing Octopress blog (or yourself from a new computer)? What we want is the same setup as above, but not from scratch.