部署时如何防止Capistrano显示密码
问题描述:
我最近开始使用Capistrano部署我的Rails应用程序,但是当它提示我输入密码时,我似乎无法弄清楚如何在部署应用程序时不显示密码。
I recently started deploying my rails apps using Capistrano, but I can't seem to figure out how to not display my password when deploying the app when it prompts me for my password.
我收到以下警告,
文本将清晰显示。请安装HighLine或Termios库以禁止显示回显文本。
我同时安装了这两个gem,但密码仍然清晰地回显文本。任何帮助将不胜感激。
I installed both of those gems, and my password is still being echoed in clear text. Any help would greatly be appreciated.
答
将此添加到config / deploy / production.rb
Add this in config/deploy/production.rb
set :ssh_options, {
keys: %w(/Users/artemadamcov/.ssh/id_rsa),
forward_agent: true,
auth_methods: %w(publickey password),
port: 4321
}
并在终端中输入
ssh-add ~/.ssh/id_rsa