title: Capistrano - deployment with git shared repository
body: <p>I'm trying to setup Capistrano to deploy my project with multiples git users. Where I work for, doesn't have (and doesn't wanna have) a generic git user, like 'git'. So the deploy config is related to the user that runs 'cap deploy'.</p>
  
  <p>As you can se in config.rb file:</p>
  
  <pre><code>set :application, "mywebsite"
  
  set :repository,  "ssh://#{scm_user}@myserver.com/repo.git"
  
  set :scm, :git
  set :scm_verbose, true
  set :deploy_via, :remote_cache
  set :git_enable_submodules, 1
  </code></pre>
  
  <p>development.rb</p>
  
  <pre><code>set :deploy_to, "/var/www/html"
  
  set :user, "myuser"
  set :password, "mypassword"
  set :scm_passphrase, "mypassword"
  </code></pre>
  
  <p>And cat ~/.caprc file:</p>
  
  <pre><code>set :scm_user, "myuser"
  </code></pre>
  
  <p>It works for the user that did the first deploy. When others users that try to do the same in their own machines, it isn't working. </p>
  
  <p>The error is related to git. It seems that Git is tying the user that made the git clone on the first deploy</p>
  
  <p>The basicaly in these lines:</p>
  
  <pre><code>executing locally: "git ls-remote ssh://THEOTHERUSER@myserver.com/repo.git HEAD"
  * executing "if [ -d /var/www/html/shared/cached-copy ]; 
      then cd /var/www/html/shared/cached-copy 
      &amp;&amp; git fetch  origin 
      &amp;&amp; git fetch --tags  origin 
      &amp;&amp; git reset  --hard 88d6aa98c52babe9368cf2bed36741f0f0b93ff2 
      &amp;&amp; git submodule  init 
      &amp;&amp; git submodule  sync 
      &amp;&amp; export GIT_RECURSIVE=$([ ! \"`git --version`\" \\&lt; \"git version 1.6.5\" ]
       &amp;&amp; echo --recursive) 
      &amp;&amp; git submodule  update --init $GIT_RECURSIVE 
      &amp;&amp; git clean  -d -x -f; else git clone ssh://THEOTHERUSER@myserver.com/repo.git /var/www/html/shared/cached-copy &amp;&amp; cd /var/www/html/shared/cached-copy 
      &amp;&amp; git checkout -b deploy 88d6aa98c52babe9368cf2bed36741f0f0b93ff2 
      &amp;&amp; git submodule init 
      &amp;&amp; git submodule sync 
      &amp;&amp; export GIT_RECURSIVE=$([ ! \"`git --version`\" \\&lt; \"git version 1.6.5\" ] 
      &amp;&amp; echo --recursive) 
      &amp;&amp; git submodule update --init $GIT_RECURSIVE; fi"
  </code></pre>
  
  <p>When I tried to debug this problem, I accessed the server machine with THEOTHERUSER ssh account and typed <code>git fetch --tags origin</code>. It asks to type the passwork of other user.</p>
  
  <p>Does anyone know what can I do to allow any user to be able to do a deploy?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>What was need to do:</p>
  
  <pre><code>set :remote, "#{scm_user}"
  set :branch, "master"
  </code></pre>
  
  <p><a href="http://ruby-doc.org/gems/docs/c/capistrano-edge-2.5.6/Capistrano/Deploy/SCM/Git.html" rel="nofollow noreferrer">http://ruby-doc.org/gems/docs/c/capistrano-edge-2.5.6/Capistrano/Deploy/SCM/Git.html</a></p>