Ruby on rails Capistrano-Net::SSH::AuthenticationFailed

Ruby on rails Capistrano-Net::SSH::AuthenticationFailed,ruby-on-rails,capistrano,Ruby On Rails,Capistrano,我想不出如何解决这个问题。卡皮斯特拉诺没有正常工作。因此无法部署我的应用程序。 这里是错误 $ bundle exec cap staging deploy (Backtrace restricted to imported tasks) cap aborted! Net::SSH::AuthenticationFailed: Authentication failed for user ec2-user@13.112.91.105 下面是一个名为config/deploy.rb的配置文件 #

我想不出如何解决这个问题。卡皮斯特拉诺没有正常工作。因此无法部署我的应用程序。 这里是错误

$ bundle exec cap staging deploy
(Backtrace restricted to imported tasks)
cap aborted!
Net::SSH::AuthenticationFailed: Authentication failed for user ec2-user@13.112.91.105
下面是一个名为config/deploy.rb的配置文件

# config valid only for Capistrano 3.1
lock '3.5.0'

set :application, 'dola'
set :repo_url, 'git@ghe.intelligence-dev.com/inolab/eiicon-dola.git'

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
set :branch, 'master'

# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/var/www/dola'

# Default value for keep_releases is 5
# set :keep_releases, 5

set :rbenv_type, :user
set :rbenv_ruby, '2.3.2-p217'
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all
set :linked_dirs, %w{bin log tmp/backup tmp/pids tmp/cache tmp/sockets vendor/bundle}
role :web, %w{13.112.91.105}

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')
    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
这里是config/deploy/staging.rb

 Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary server in each group
# is considered to be the first unless any hosts have the primary
# property set.  Don't declare `role :all`, it's a meta role.

role :app, %w{ec2-user@13.112.91.105}
role :web, %w{ec2-user@13.112.91.105}

# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server '13.112.91.105', user: 'ec2-user', roles: %w{web app}, my_property: :my_value

# Custom SSH Options
# ==================
set :stage, :staging
set :rails_env, 'staging'
server '13.112.91.105', user: 'ec2-user',
roles: %w{web app} 
set :ssh_options, {
   keys: [File.expand_path('~/.ssh/id_rsa_ec2.pem)')]
}

任何人都可以

Capistrano正在尝试在您的计算机和您试图部署应用程序的计算机之间建立SSH会话—在本例中为13.112.91.105。为了做到这一点,考虑到您的Capistrano配置,您需要能够使用您的SSH私钥(我假设是
~/.SSH/id\u rsa\u ec2.pem)作为用户
ec2用户对13.112.91.105上运行的SSH服务器进行身份验证。为了让这一切发生,计算机13.112.91.105上的
ec2用户
authorized_key
文件中必须列出相应的SSHpublic密钥。

Capistrano正在尝试在您的计算机和您试图部署应用程序的计算机之间建立SSH会话-在本例中为13.112.91.105。为了做到这一点,考虑到您的Capistrano配置,您需要能够使用您的SSH私钥(我假设是
~/.SSH/id\u rsa\u ec2.pem)作为用户
ec2用户对13.112.91.105上运行的SSH服务器进行身份验证。为此,必须在机器13.112.91.105上的
ec2用户的
authorized_-keys
文件中列出相应的SSHpublic密钥。

部署密钥和SSH密钥配置正确吗?感谢您的评论。顺便说一句,“部署密钥”是什么意思?您的部署密钥和ssh密钥配置正确吗?谢谢您的评论。顺便说一句,你说的“部署密钥”是什么意思?我明白了。我将尝试按照您稍后的建议进行配置。谢谢。很抱歉回复晚了。上班后,我照你说的做了。它起作用了!谢谢。@edurante如果答案正确,你可以接受。我明白了。我将尝试按照您稍后的建议进行配置。谢谢。很抱歉回复晚了。上班后,我照你说的做了。它起作用了!谢谢。@edurante如果答案正确,你可以接受。