capistrano password prompt

2019-07-14 14:19发布

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 g...@github.com: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 g...@github.com: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!

2条回答
相关推荐>>
2楼-- · 2019-07-14 15:15

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
查看更多
Emotional °昔
3楼-- · 2019-07-14 15:15

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

查看更多
登录 后发表回答