1

Here's my Capistrano file:

set :application, "mydemoapp"
set :repository,  "git@bitbucket.org:sergiotapia/mydemoapp.git"
set :scm, :git

set :user, "serg" # The user on the VPS server.
set :use_sudo, false
set :deploy_to, "/opt/nginx/html/#{application}"
set :deploy_via, :remote_cache
set :keep_releases, 1
set :rails_env, "production"
set :migrate_target, :latest

role :web, "192.168.1.1"  # Your HTTP server, Apache/etc
role :app, "192.168.1.1"  # This may be the same as your `Web` server
role :db,  "192.168.1.1", :primary => true # This is where Rails migrations will run

The IP addresses above are obviously fake, I'm using the IP for my VPS server in real life.

I ran this command, to verify that BitBucket is allowing me to access the repository:

sergiotapia@jarvis1:~/.ssh$ ssh -T hg@bitbucket.org
conq: logged in as sergiotapia.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

However, running cap deploy again, I get:

[198.211.101.99] executing command
 ** [192.168.1.1:: err] Permission denied (publickey).
 ** [192.168.1.1:: err] fatal: The remote end hung up unexpectedly
    command finished in 1026ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /opt/nginx/html/demoapp/releases/20130601025656; true"

I tried using git clone from my SSH terminal, manually and it worked fine as expected. My project cloned to a folder properly.

It seems Capistrano is running sudo git clone instead of git clone. This is verified by myself running a sudo git clone in the same folder manually on my SSH. Same Permission denied (publickey) error.

Why isn't my Capistrano setting for :use_sudo, false being used?

4

0 回答 0