我正在尝试使用capistrano设置部署到AWS EC2实例。为了测试,我正在使用
cap testing deploy:check
但Capistrano失败了:
triggering load callbacks
* 2013-03-12 15:41:27 executing `testing'
triggering start callbacks for `deploy:check'
* 2013-03-12 15:41:27 executing `multistage:ensure'
* 2013-03-12 15:41:27 executing `deploy:check'
* executing "test -d /......./releases"
servers: ["ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com"]
connection failed for: ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com
(NoMethodError: undefined method `each' for "publickey":String)
我正在使用我的.pem文件进行连接,deploy.rb脚本如下所示:
set :stages, %w(production testing)
set :default_stage, 'testing'
require 'capistrano/ext/multistage'
set :application, 'app_name'
set :user, 'the_user'
set :group, 'the_group'
set :scm, :git
set :repository, "git@github.com:......./#{application}.git"
set :deploy_to, '/......./'
set :deploy_via, :remote_cache
# Authentication setup
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
ssh_options[:auth_methods] = 'publickey'
ssh_options[:keys] = ['~/........pem']
知道为什么会这样吗?
答案 0 :(得分:0)
尝试将您的公钥放在服务器上。
并删除
ssh_options [:auth_methods] ='publickey'
ssh_options [:keys] = ['〜/ ........ pem']
应该有效
答案 1 :(得分:0)
我最近升级了一个开发服务器并看到了相同的行为。错误消息看起来好像Capistrano期望迭代,publicKey
的赋值不是这样定义的。
尽管听起来微不足道,但请尝试更改:
ssh_options[:auth_methods] = 'publickey'
ssh_options[:keys] = ['~/........pem']
为:
set :ssh_options, {:auth_methods => "publickey"}
set :ssh_options, {:keys => ["~/......pem"]}
您可能需要对身份验证设置中的其他项执行相同的操作。祝你好运。
答案 2 :(得分:0)
删除行
ssh_options[:auth_methods] = 'publickey'