I\'ve inherited a Rails project, hosted on Linode.
The previous developer was using a BitBucket repository, along with Capistrano for deployments.
I\'ve since
If you're still stuck I answered a similar question as yours here: SSH Agent Forwarding not working
Check if your key is added to the list of agent identities with ssh-add -L
.
for me the only way it has deploy was:
adding the local id_rsa to the server
cat ~/.ssh/github_rsa.pub | ssh -i /Users/jasmo2/Documents/AWS-keypair/designmatch.pem ubuntu@52.37.202.32 "cat >> .ssh/authorized_keys"
after typing the command. Is preferable to set the set :ssh_options.
Then
set :use_sudo, true
on the deploy.rb file.
Finally instal
sudo apt-get install libpq-dev
gem install pg -v '0.18.4'
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :mkdir, '-p', "#{ release_path }/tmp"
execute :touch, release_path.join('tmp/restart.txt')
end
end
Note you will also get this error if the deployment server has no disk space!
Today I found the root cause on MAC. My ssh key was not added to the authentication agent so the key was not forwarded. The solution was to execute the following command:
ssh-add ~/.ssh/id_dsa
(or ssh-add ~/.ssh/id_rsa
if you use rsa key)
To remove all the ssh keys added to agent
ssh-add -D
Try adding the following line to your Capistrano script, this will explicitly tell Capistrano what key it should be using.
set :ssh_options, {
forward_agent: true,
paranoid: true,
keys: "~/.ssh/id_rsa"
}
Similarly I could SSH from dev machine to the staging machine and also SSH from staging machine to github.com.
However cap deploy failed doing the git clone
Permission denied (publickey).
however the git ls-remote worked which is strange.
If I added this to my config on the staging machine it works
Host github.com
Hostname github.com
IdentityFile ~/.ssh/git
User git