Net::SSH::AuthenticationFailed: Authentication failed for user

Did you add your key to the Agent?

What do you see when you run:

$ ssh-add -l

If you get 'The agent has no identities.', then add your key with:

$ ssh-add id_rsa_key_name

First of all you need to ssh to your server and run

eval `ssh-agent`

and then

ssh-add ~/.ssh/id_rsa

and now change

set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }
# 

to

set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa) }
#

I just removed pub from id_rsa.pub.

And then run

cap production deploy:initial

It should work now. Same changes fixed the issues for my app https://www.wiki11.com.


You have : set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }

Change it to: set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa) }

Keys should have private key location only. Also, enable ssh-agent on local machine using ssh-add. Add ForwardAgent yes in ~/.ssh/config for your Host.