簡體   English   中英

Capistrano 3 部署要求輸入 SSH 密碼,但無法輸入

[英]Capistrano 3 deploy asking for SSH passphrase but cannot type it in

我正在嘗試使用 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 密碼嗎?

我有同樣的問題。

我所做的是改變我的配置。 為了避免 capistrano 要求您必須設置密碼短語

set :pty, false

然后,您必須在用於啟動終端的任何計算機上生成部署密鑰(您可以在此處找到非常好的指南https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git特別是如果您使用的是 bitbucket)並運行cap production deploy

問題是,默認情況下,capistrano 會將forward_agent設置為true ,這將使用您計算機中生成的密鑰在遠程代碼存儲庫中進行身份驗證。

我所做的是刪除密碼

第 1 步:$ ssh-keygen -p

第二步:$ ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]

參考:

如何刪除 SSH 密鑰的密碼而不必創建新密鑰?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM