title: Capistrano 3 runs every command twice (new install) - Configuration issue
body: <p>I just completed my capistrano installation for the first time. Most of everything is left to default settings, I configured my server, its authentification, and the remote folder, as well as the access to my git repository.</p>
  
  <p>I use capistrano to deploy php code to my server.</p>
  
  <p><em>cap staging deploy</em> and <em>cap production deploy</em> function, but <strong>they run every command twice</strong>. It sometimes causes problems when those tasks are executed too quickly on the server, returning error codes, which stops the deploying process.</p>
  
  <p>an example of my output when running <em>cap staging deploy</em></p>
  
  <pre><code>DEBUG[47ecea59] Running /usr/bin/env if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1&gt;&amp;2; false; fi on ftp.cluster013.ovh.net
  DEBUG[47ecea59] Command: if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1&gt;&amp;2; false; fi
  DEBUG[c450e730] Running /usr/bin/env if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1&gt;&amp;2; false; fi on ftp.cluster013.ovh.net
  DEBUG[c450e730] Command: if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1&gt;&amp;2; false; fi
  </code></pre>
  
  <p>It does the same with every single task, except the one I defined myself (in my deploy.rb, I defined a :set_distant_server task that moves around files with server info)</p>
  
  <p>I am pretty sure I missed something during the initial configuration.</p>
  
  <p>Here is my capfile, still to default settings :</p>
  
  <pre><code># Load DSL and Setup Up Stages
  require 'capistrano/setup'
  
  # Includes default deployment tasks
  require 'capistrano/deploy'
  
  # Includes tasks from other gems included in your Gemfile
  # require 'capistrano/rvm'
  # require 'capistrano/rbenv'
  # require 'capistrano/chruby'
  #require 'capistrano/bundler'
  #require 'capistrano/rails/assets'
  #require 'capistrano/rails/migrations'
  
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
  Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
  </code></pre>
  
  <p>Followed by my deploy.rb file:
      # config valid only for Capistrano 3.1
      lock '3.2.1'</p>
  
  <pre><code>set :scm, :git
  set :application, 'Application name'
  # I use token authentification
  set :repo_url, 'https://XXXXXXXXXXX:@XXXXXXX.git'
  
  set :role, 'web'
  
  
  # Default value for :log_level is :debug
  set :log_level, :debug
  set :tmp_dir, 'www/test_server/tmp'
  set :keep_releases, 8
  
  
  role :deploy_server, "XXXuser_name@XXXX_server"
  
  task :set_distant do
      on roles(:deploy_server) do
          execute 'echo ------------******* STAGING *******------------'
          execute 'cp ~/www/test_server/current/access_distant.php ~/www/test_server/current/access.php'
          execute 'cp ~/www/test_server/current/session_distant.php     ~/www/test_server/current/session.php'
      end
  end
  
  
  after "deploy:finished", :set_distant
  </code></pre>
  
  <p>Here is my staging.rb, much shorter:</p>
  
  <pre><code> server 'XXX_server', user: 'XXXuser_name', roles: %w{web}, port: 22, password: 'XXXpassword'
   set :deploy_to, '~/www/test_server'
   set :branch, 'staging'
  </code></pre>
  
  <p>And my production.rb, very similar:</p>
  
  <pre><code> server 'XXX_server', user: 'XXXuser_name', roles: %w{web}, port: 22, password: 'XXXpassword'
   set :deploy_to, '~/www/beta/'
  </code></pre>
  
  <p>I'm pretty sure I missed a step in all the prerequisites to make it run nicely. I am new to ruby, to gems, and didn't use shell for a very long time. </p>
  
  <p>Does anyone see why those commands are run twice, and how I could fix it?</p>
  
  <p>In advance, many many  thanks.</p>
  
  <p>Additional info:
  Ruby version:  ruby -v
  ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]</p>
  
  <p>Capistrano version: cap -V
  Capistrano Version: 3.2.1 (Rake Version: 10.1.0)</p>
  
  <p>I did not create a Gemfile or set it up, I understood it was not needed in Capistrano 3. Anyway, I would not know how to do it.</p>