Cap deploy with no password

Each time I use cap deploy I have to type in the password for the user
I assigned to do cap deploy. This is getting kind of annoying, so I’m
wondering how I can do this without having to type in the password
each time.

You’ll have to setup your SSH keys to the server where the application
is being deployed - http://pkeck.myweb.uga.edu/ssh/

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

I did that but it’s still asking for passwords.

On Jun 16, 6:34 pm, Maurício Linhares [email protected]

Then you did something wrong :slight_smile:

Review whatever you did and do it again.

You should also do the same from the machine where the code is being
deployed to the machine where your source code repo lives, specially
if you’re using git and ssh.

Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

Mike C wrote:

Er well it worked but it still asks for a password. You see, for doing
git push it used to ask for a password but it doesn’t anymore, and
using cap deploy:update_code used to ask for the password 3 times but
now it only asks for it once.

There are two separate things going on. cap remotely ssh’s on to the
remote server - ssh keys can prevent requiring entering a password here

  • and then on the remote machine cap accesses your git repository.

If you have told cap to access it as ssh:// etc… then a password is
required for this also - so you need ssh shared keys between the
deployment server and the git repository.

But the deployment server and the git repository are the same server
in my case. What should I do?

Er well it worked but it still asks for a password. You see, for doing
git push it used to ask for a password but it doesn’t anymore, and
using cap deploy:update_code used to ask for the password 3 times but
now it only asks for it once.

On Jun 16, 7:12 pm, Maurício Linhares [email protected]

Anyone have any ideas?

It would be the same if its local or remote you still have to setup
ssh keys so that the user has access to ssh to localhost without
password

So if its the same user to deploy/run cap just add your pub key to
your own .ssh/authorized_keys file…

When this is done you should be able todo this ssh localhost and get
no password

the command to generate the keys is ssh-keygen -t dsa then enter enter

you should now have a directory in ~/.ssh with a key file and the
public key… add the pub key to a file ~/.ssh/authorized_keys set the
permission to 600 (chmod 600 ~/.ssh/authorized_keys) then do ssh
localhost

Thanks a bunch, that did the trick. :slight_smile: