Cloning an Octopress Repo

- -

When attempting to clone my Octopress repository on a new machine, I had the same Updates were rejected problem that is described on this page. Based on the information provided on that page, combined with a few other commands required for Ubuntu machines, this post provides instructions for cloning an Octopress repository.

(This works on Ubuntu 13.10 and probably other variants.)


  1. Make sure ruby1.9.1-dev and gem are installd:

    sudo apt-get install ruby1.9.1-dev gem
    gem install bundler
    rbenv rehash
    
  2. Get the source and initialize empty _deploy directory:

    git clone git@github.com:williamdemeo/williamdemeo.github.io.git
    cd williamdemeo.github.io/
    git checkout source
    mkdir _deploy
    cd _deploy
    git init
    git remote add -t master -f origin git@github.com:williamdemeo/williamdemeo.github.io.git
    cd ..
    
  3. Use bundler to check that all the dependencies in GemFile are met:

    bundle install
    
  4. Generate the pages and deploy:

    rake generate
    rake deploy
    

Troubleshooting. If rake generate produces “invalid byte sequence in US-ASCII” then try the following:

    # from the command line
    export LANG=en_US.UTF-8
    export LANGUAGE=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    bundle

Workflow

  1. Make some changes, e.g., create a new post:

    rake new_post["title"]
    
  2. Posts live in source/_posts. Edit one and push the changes to source branch either directly with Magit or with

    git add .
    git commit -am "explanation of changes" 
    git push origin source
    
  3. Now preview the changes: rake preview and load http://localhost:4000 in browser.

  4. When satisfied, rake deploy.


Other Resources