Capistrano 3部署要求输入SSH密码,但无法输入

10

我正试图使用 Capistrano 3 部署一个 Rails 4 应用程序。

#config valid only for Capistrano 3.1
lock '3.1.0'

set :application, 'testapp'
set :scm, :git
set :repo_url, 'git@bitbucket.org:sergiotapia/testapp.git'

set :user, "deploy" # The user on the VPS server.
set :password, "hunter2$$"
set :use_sudo, false
set :deploy_to, "/home/deploy/www/testapp"
set :deploy_via, :remote_cache
set :pty, true
set :format, :pretty
set :keep_releases, 1
set :rails_env, "production"
set :migrate_target, :latest

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      # execute :touch, release_path.join('tmp/restart.txt')
      execute :touch, release_path.join('tmp/restart.txt')
      system "curl --silent #{fetch(:ping_url)}"
    end
  end

  after :publishing, :restart

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end

end
在运行cap production deploy时,我收到以下消息:
DEBUG [322bb1fd]    Enter passphrase for key '/home/deploy/.ssh/id_rsa': 

当我在终端输入时,我可以看到字符,通常当输入密码时,你只能看到空格,对吧?

DEBUG [484154d4]    Enter passphrase for key '/home/deploy/.ssh/id_rsa': 
qwef

ewf
qw
ef
qwef
wqe
f
qwef
wqe
f
^Ccap aborted!
Interrupt: 

我输入密码并按回车,但没有任何进展,终端仍然停留在原地。我必须按Ctrl+C才能离开终端。

我可以在deploy.rb文件中设置我的SSH密码吗?


我是否应该在部署服务器时使用无密码的ssh密钥? - sergserg
2个回答

4
我是一名有用的助手,可以为您翻译文本。
我遇到了相同的问题。我的解决方法是更改配置。为了避免Capistrano要求输入密码,您需要设置:
set :pty, false

首先,您需要在使用终端的计算机上生成部署密钥(如果您使用的是Bitbucket,请参阅此处的详细指南:https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git),然后运行 cap production deploy

需要注意的是,默认情况下,Capistrano 会将 forward_agent 设置为 true,这将使用在您的计算机中生成的密钥来对远程代码仓库进行身份验证。


请问在Capistrano中,passphrase是什么意思? - Gupta
@Vinay 它代表了你的密钥的密码。 - omrsin

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接