【问题标题】:capistrano password promptcapistrano 密码提示
【发布时间】:2010-09-29 22:45:34
【问题描述】:

Capistrano 每次部署时都会要求我输入密码。怎么做 我不让它发生?

ruby 版本 1.8.7 REE

capistrano 版本 2.5.19

这是我的 capfile 和目录权限。

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

更新

好的,我现在一团糟,现在我收到了这个错误。

http://pastie.org/1190332

我添加了一个“部署”用户,例如..

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

然后我在我的 .ssh/config 文件中添加了你提到的配置。

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

请帮忙!

【问题讨论】:

  • 您的新错误是因为您的新用户“部署”可能无权访问您尝试从 git 更新的文件。只需将 .ssh/config 文件中的用户重命名为您正在连接的原始用户...

标签: ruby-on-rails capistrano


【解决方案1】:

Github 可能会询问您的密码,因为从您的服务器连接时它没有获取您的 ssh 密钥。在您的~/.ssh/config 中设置代理转发:

Host my_deploy_server
  Hostname 1.2.3.4
  User deploy
  ForwardAgent yes

Host *
  ForwardAgent no

【讨论】:

  • 我的 deploy_server 在这种情况下是我部署的桌面?
  • 不,这是您要部署到的服务器的方便名称:随意命名。这也让您可以使用ssh myserver 而不必拼出ssh deploy@myserver.example.com
  • 部署脚本中不需要ssh_options[:forward_agent] = true 吗?还是为了别的?
  • 主机名 1.2.3.4 是什么?
  • 好的,我现在一团糟,现在我收到了这个错误。我添加了一个“部署”用户,例如..
【解决方案2】:

这可能是您服务器的密码。尝试在您部署的机器和目标服务器之间设置共享密钥。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2014-02-28
  • 1970-01-01
  • 1970-01-01
  • 2010-09-30
  • 1970-01-01
  • 1970-01-01
  • 2014-01-14
  • 1970-01-01
相关资源
最近更新 更多