title: git ruby script not working "must be run in a work tree"
body: <p>Want to copy the contents of the CWD repo (bare) into the '../deploy' folder. The git command below works just fine on the Bash command line (with manual variable substitution) but always errors out when called using backticks in ruby. What's the problem?</p>
  
  <pre><code>#!/usr/bin/env ruby
  deploy_to_dir = File.expand_path('../deploy')
  `GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f master`
  </code></pre>