Probably something simple, but I'm at wit's end after exploring everything 
i know of from the Cap docs and elsewhere.

I set up my `deploy.rb` like so:

```ruby
SSHKit.config.command_map[:rake] = "bundle exec rake" # Ensure that bundle 
is used for rake tasks
lock '3.1.0' # config valid only for Capistrano 3.1

set :application, '[myapp]'
set :user, "deploy"

set :deploy_to, '/var/www/[myapp]'
set :use_sudo, false
set :pty, false
set :keep_releases, 5
set :format, :pretty
set :log_level, :debug

set :repo_url, '[email protected]:....git'
set :scm, :git
set :branch, 'master'

set :ssh_options, { forward_agent: true }
...
```

My stage file for the `acceptance` stage looks like this:

```ruby
set :stage, :acceptance
set :node_env, 'test'
set :user, 'deploy'

role :app, 'ec2-....compute-1.amazonaws.com'
role :web, 'ec2-....compute-1.amazonaws.com'
role :db,  'ec2-....compute-1.amazonaws.com'
role :server_pipeline, 'ec2-....compute-1.amazonaws.com'

server 'ec2-....compute-1.amazonaws.com', 
 user: 'deploy',
 roles: %w{server_pipeline},
 primary: true,
 keys: ['~/.ssh/blah.pem']
```

With that, I get this result when I run `cap acceptance deploy`:

DEBUG [a824cd7c] Running /usr/bin/env git ls-remote [email protected]:....git 
on ec2-....compute-1.amazonaws.com
DEBUG [a824cd7c] Command: ( GIT_ASKPASS=/bin/echo 
GIT_SSH=/tmp/[myapp]/git-ssh.sh /usr/bin/env git ls-remote 
[email protected]:....git )
DEBUG [a824cd7c] Permission denied (publickey).
DEBUG [a824cd7c] fatal: Could not read from remote repository.
DEBUG [a824cd7c]
DEBUG [a824cd7c] Please make sure you have the correct access rights
DEBUG [a824cd7c] and the repository exists.
DEBUG [a824cd7c] Finished in 0.175 seconds with exit status 128 (failed).

The maddening thing is that I can copy the command on the second output 
line above verbatim and run it from the command line on my server and it 
works fine. I reread the Cap page about things working via SSH but not when 
run by Cap, but couldn't see anything there to explain the result I'm 
getting. Here's what else I checked:

   - I confirmed that I followed all instructions from *Authentication & 
   Authorisation* followed, the deploy user exists, and all dirs exist with 
   the correct permissions
   - The ssh agent on the target box is running, and my key is loaded
   - I set up no-password access for the `deploy` user
   - I can run `git ls-remote` from the box and get a response from GitHub
   - `ssh -vT [email protected]` confirms I can connect

So I'm stumped. Don't know what else to try. Can anyone suggest something 
else to check/change? SSH issues can be so frustrating.

-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/31753487-1896-4e12-ad58-cd07868f142a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to