title: Capistrano deploy from local machine
body: <p>Im trying to create a new user to deploy my application from my local machine to my external server. </p>
  
  <p>I've got it working using root but understand it's not secure to use root, therefore I want to create a user called 'deployer'. I've added this user to my external server and copied my local is_rsa.pub key to /.ssh/authorized_keys on the server, however when I run <code>cap development deploy</code> I keep getting the following error:</p>
  
  <pre><code>failed: "sh -c 'if [ -d /var/www/vhosts/xyz.co.uk/shared/cached-copy ]; then cd
    /var/www/vhosts/xyz.co.uk/shared/cached-copy &amp;&amp; git fetch -q origin &amp;&amp; git fetch --
  tags -q origin &amp;&amp; git reset -q --hard 2b738f4ca8008dcf9e84c4be5d63d906a7bfd760 &amp;&amp; git clean 
  -q -d -x -f; else git clone -q git@github.com:xyz/xyz.co.uk.git 
  /var/www/vhosts/xyz.co.uk/shared/cached-copy &amp;&amp; cd /var/www/vhosts/xyz.co.uk/shared/cached-
  copy &amp;&amp; git checkout -q -b deploy 2b738f4ca8008dcf9e84c4be5d63d906a7bfd760; fi'" on 
  x.xx.xx.xxx
  </code></pre>
  
  <p>If I run ssh -T git@github.com on the external server it says:</p>
  
  <pre><code>Hi username! You've successfully authenticated, but GitHub does not provide shell access.
  </code></pre>
  
  <p>This username is not deployer though, I assume its the username of the github account.</p>
  
  <p>Any ideas what I need to do? Do I need to create the deployer user on my local machine too?</p>
  
  <p>Here is my deploy.rb file:</p>
  
  <pre><code>set :stage_dir, 'app/config/deploy' # needed for Symfony2 only
  set :stages, %w(production staging development)
  require 'capistrano/ext/multistage'
  
  set :application,           "xyz.co.uk"
  set :user,                  "deployer"  # The server's user for deploys
  
  set :normalize_asset_timestamps, false
  
  set :repository,            "git@github.xyz/xyz.co.uk.git"
  set :scm,                   :git
  set :keep_releases,         3
  after "deploy:update",      "deploy:cleanup"
  set :use_sudo,              false
  set :web_path,              "web"
  set :shared_files,          ["app/config/parameters.yml"]
  set :shared_children,       [app_path + "/logs", web_path + "/uploads"]
  set :use_composer,          true
  set :update_vendors,        true
  set :dump_assetic_assets,   true
  set :deploy_via,            :remote_cache
  
  #logger.level = Logger::MAX_LEVEL
  
  after "deploy:update_code" do
    capifony_pretty_print "--&gt; Ensuring cache directory permissions"
    run "setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
    run "setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
    capifony_puts_ok
  end
  </code></pre>
  
  <p>deveopment.rb file:</p>
  
  <pre><code>server 'x.xx.xx.xxx', :app, :web, :db, :primary =&gt; true
  ssh_options[:port] = 1234
  ssh_options[:forward_agent] = true
  default_run_options[:pty] = true
  set :deploy_to, "/var/www/vhosts/xyz.co.uk"
  set :symfony_env_prod, "dev"
  set :branch, "develop"
  
  # Need to clear *_dev controllers
  set :clear_controllers,     false
  </code></pre>
  
  <p>Thanks</p>