views:

47

answers:

2

Capistrano keeps asking me for password for every deplyoyment. How do I not let it happen?

ruby version 1.8.7 REE

capistrano version 2.5.19

Here is my capfile and directory permissions.

http://pastie.org/1189919

Everything up-to-date
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote [email protected]:username/
app_name.git master"
  * executing "if [ -d /var/www/app_name/shared/cached-copy ]; then
cd /var/www/app_name/shared/cached-copy && git fetch -q origin && git
reset -q --hard 5d47453e28385200daa971ca4982632caf7fb67e && git clean -
q -d -x -f; else git clone -q [email protected]:username/app_name.git /
var/www/app_name/shared/cached-copy && cd /var/www/app_name/shared/
cached-copy && git checkout -q -b deploy
5d47453e28385200daa971ca4982632caf7fb67e; fi"
    servers: ["1xx.2xx.xxx.xxx"]
Password:
    [173.230.158.13] executing command
    command finished

Update

OK, i am in a super bad mess, now I get this error.

http://pastie.org/1190332

I added a "deploy" user like..

adduser --system --home /home/deploy --shell /bin/bash --ingroup nogroup deploy
chmod u+w /etc/sudoers
echo "deploy  ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chmod u-w /etc/sudoers

Then I added the configuration you mentioned in my .ssh/config file.

Host prod
  Hostname xxx.xxx.xxx.xx
  User deploy
  ForwardAgent yes

Please help!

+1  A: 

It's probably the password for your server. Try setting shared keys between the machine you are deploying from and the destination servers.

Chris Gutierrez
sorry, ssh isn't my strength..how do I do this?
badnaam
Here is a tutorial for it. Covers how to do it using unix and windows. http://hkn.eecs.berkeley.edu/~dhsu/ssh_public_key_howto.html
Chris Gutierrez
+2  A: 

Github is probably asking for your password because it's not getting your ssh key when connecting from your server. Set up agent forwarding in your ~/.ssh/config:

Host my_deploy_server
  Hostname 1.2.3.4
  User deploy
  ForwardAgent yes

Host *
  ForwardAgent no
Andrew Vit
my deploy_server in this case is my desktop where I am deploying from?
badnaam
No, this is a convenience name for the server you're deploying to: name it whatever you like. This also lets you do `ssh myserver` instead of having to spell out `ssh [email protected]`
Andrew Vit
Don't you also need `ssh_options[:forward_agent] = true` in the deploy script? or is that for something else?
zetetic
and what is the Hostname 1.2.3.4?
badnaam
OK, i am in a super bad mess, now I get this error. I added a "deploy" user like..
badnaam
Andrew Vit
zetetic is right, you can use `ssh_options[:forward_agent]` in your deploy script as well, but that only sets it for capistrano, not when you connect directly using ssh.
Andrew Vit