当我在CentOS上使用capistrano'限制生产部署'时,我会遇到以下错误。
我确信我的git和服务器的pirvate密钥都是完美的原始文件,公钥通常在服务器上。
我有 ssh_options [:keys] = [File.join(ENV [“HOME”],“。ssh”,“example-rsa”)] 在我的production.rb中,我正确地将文件作为/root/.ssh/example-rsa。 我 ssh-add ed我的git和服务器的私钥。
奇怪的是,即使两个文件都需要密码短语,我的终端也要求我输入git的密码,但不是服务器的密码。
我用服务器,opeenssh等同步了我的ruby版本。
triggering start callbacks for `deploy'
* 2014-02-27 10:09:45 executing `multistage:ensure'
* 2014-02-27 10:09:45 executing `deploy'
* 2014-02-27 10:09:45 executing `deploy:update'
** transaction: start
* 2014-02-27 10:09:45 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:example/AskOnStack.git HEAD"
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/AskOnStack/releases/20140227010945; true"
servers: ["**.**.***.**"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: **.**.***.**:****
(NotImplementedError: unsupported key type `��"�ep���ˎ��-�wƿ3�����-���S�(�')
// this part is the start of errors. what are those strange texts?
/home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:138:in ``': No such file or directory - git ls-remote git@github.com:mocoga/KakaoGameFriend.git HEAD (Errno::ENOENT)
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano- 2.15.5/lib/capistrano/recipes/deploy.rb:138:in `block in run_locally'
from /home/stackoverflow/.rvm/rubies/ruby-1.9.3-p392-railsexpress/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:137:in `run_locally'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block (3 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:124:in `with_env'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/git.rb:229:in `query_revision'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:35:in `block in method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:63:in `local'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:87:in `call'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:87:in `block in fetch'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:110:in `block in protect'
from <internal:prelude>:10:in `synchronize'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:110:in `protect'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:78:in `fetch'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:95:in `[]'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/base.rb:86:in `revision'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/remote_cache.rb:35:in `update_repository_cache'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/remote_cache.rb:15:in `deploy!'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:253:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:234:in `block (3 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:56:in `transaction'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:233:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:201:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/cap:23:in `load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/cap:23:in `<main>'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/ruby_executable_hooks:15:in `eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/ruby_executable_hooks:15:in `<main>'
答案 0 :(得分:0)
通过删除newline
中ssh-rsa
之后的$HOME/.ssh/id_rsa.pub
字符解决问题。
如果您使用其他公钥文件,请更改该文件。
答案 1 :(得分:0)
我的问题是我的本地~/.ssh/known_hosts
文件中有很多不同的密钥,因为每次我的VPS在救援模式下重新启动它都会改变。
所以我删除了所有这些并正常连接到ssh(而不是通过capistrano),然后我尝试使用capistrano并且它有效。
其他详细信息:当ssh无法读取密钥文件时,会发生这种情况,您可以运行ssh -v user@host
来查看正在进行的操作
(请参阅第一个答案中的评论:https://serverfault.com/questions/613756/how-to-stop-ssh-passphrase-prompt)
答案 2 :(得分:0)
就我而言,我得到
cap aborted!
Z?.?.D??'entedError: unsupported key type `??c=M?#HF?:??
当我尝试使用capistrano在puma
服务器上重启prod
时:
bundle exec cap production puma:restart --trace
这是一个非常奇怪的问题,我花了几分钟时间才找到要解决的问题...我想检查哪个文件失败,capistrano
将运行常规的ssh
命令,而我我可以肯定地说,我可以ssh
服务器正常运行,我确认:
ssh -v -i my_key.pem ec2-user@6.66.666.666
我能够做到。
在我看来,一切似乎都net-ssh
并未解析其中一个文件,这就是我查找多少文件以及可以使用哪些文件的方法。
使用:
ls ~/.ssh
我看到了所有这些
my_key.pem config id_rsa id_rsa.pub known_hosts
我不得不逐个重命名每个文件,以查找将导致不同错误的文件,直到发现其他错误消息我才这么做:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as
....
Authentication failed for user
....
**这是known_hosts
**文件!!!由于此文件是自动生成的,因此我仅创建了一个备份(mv ~/.ssh/known_hosts ~/.ssh/known_hosts.BAK
)并继续前进! :)终于能够重新启动产品的服务器puma流程,这使Web应用程序可以像以前一样运行(AWS EC2实例出现问题,因此必须重新启动该框)