title: Capistrano deploy incomplete
body: <p>I want to deploy a local application to a production server with Capistrano. However something fails and I don't know how to fix it. The good news is that the <code>/shared/cached-copy</code> is fully created on the remote server. How can I fix the <code>rsync</code> error?</p>
  
  <pre><code>cap deploy
    * executing `deploy'
    * executing `deploy:update'
   ** transaction: start
    * executing `deploy:update_code'
      updating the cached checkout on all servers
      executing locally: "git ls-remote git@bitbucket.org:foo/bar.git HEAD"
    * executing "if [ -d /path/foo/shared/cached-copy ]; then cd /path/foo/shared/cached-copy &amp;&amp; git fetch -q origin &amp;&amp; git fetch --tags -q origin &amp;&amp; git reset -q --hard e216d5f840f3d78458a3734a3830a4030750c85c &amp;&amp; git clean -q -d -x -f; else git clone -q git@bitbucket.org:foo/bar.git /path/foo/shared/cached-copy &amp;&amp; cd /path/foo/shared/cached-copy &amp;&amp; git checkout -q -b deploy e216d5f840f3d78458a3734a3830a4030750c85c; fi"
      servers: ["foo.com"]
      [foo.com] executing command
      command finished in 33589ms
      copying the cached version to /path/foo/releases/20120204063129
    * executing "rsync -lrpt --exclude=\".git\" --exclude=\".DS_Store\" --exclude=\".gitignore\" --exclude=\".gitmodules\" /path/foo/shared/cached-copy/ /path/foo/releases/20120204063129 &amp;&amp; (echo e216d5f840f3d78458a3734a3830a4030750c85c &gt; /path/foo/releases/20120204063129/REVISION)"
      servers: ["foo.com"]
      [foo.com] executing command
  *** [err :: foo.com] rsync: mkdir "/path/foo/releases/20120204063129" failed: No such file or directory (2)
  *** [err :: foo.com] rsync error: error in file IO (code 11) at main.c(587) [Receiver=3.0.8]
  *** [err :: foo.com] rsync: connection unexpectedly closed (9 bytes received so far) [sender]
  *** [err :: foo.com] rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.8]
      command finished in 899ms
  *** [deploy:update_code] rolling back
    * executing "rm -rf /path/foo/releases/20120204063129; true"
      servers: ["foo.com"]
      [foo.com] executing command
      command finished in 841ms
  failed: "sh -c 'rsync -lrpt --exclude=\".git\" --exclude=\".DS_Store\" --exclude=\".gitignore\" --exclude=\".gitmodules\" /path/foo/shared/cached-copy/ /path/foo/releases/20120204063129 &amp;&amp; (echo e216d5f840f3d78458a3734a3830a4030750c85c &gt; /path/foo/releases/20120204063129/REVISION)'" on foo.com
  </code></pre>
  
  <p>My <code>deploy.rb</code> file:</p>
  
  <pre><code>set :application, "FooBar"
  set :repository, "git@bitbucket.org:foo/bar.git"
  set :scm, :git
  set :deploy_to, "/path/foo"
  set :deploy_via, :remote_cache
  set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"]
  set :user, "foobar"
  server "foobar.tdl", :app
  ssh_options[:forward_agent] = true
  </code></pre>