0

我正在尝试将应用程序部署到亚马逊网络服务器。我已经安装并运行了 git(我已经成功推送。但是当我尝试进行 cap deploy 时,我得到“权限被拒绝”

这是错误:

   servers: ["22.229.78.34"]
   [ubuntu@22.229.78.34] executing command
   ** [22.229.78.34 :: out] Cloning into '/home/ubuntu/liquid_admin/releases    /20130703153332'...
   ** [22.229.78.34 :: out] Permission denied (publickey).
   ** fatal: The remote end hung up unexpectedly
   command finished in 779ms
   *** [deploy:update_code] rolling back

这是部署文件:

require 'bundler/capistrano'
set :user, 'ubuntu'
set :domain, 'ubuntu@22.229.78.34'
set :applicationdir, "~/liquid_admin"

set :scm, 'git'
set :repository,  "ssh://ubuntu@22.229.78.34/~/liquid_admin.git"
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :application, "liquid.radio"

# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent      guess based on known version control directory names   

或:accurev, bzr, cvs, darcs, git, mercurial, perforce,subversionnone

role :web, "ubuntu@22.229.78.34"                          # Your HTTP server, Apache/etc
role :app, "ubuntu@22.229.78.34"                          # This may be the same as your `   Web` server
role :db,  "ubuntu@22.229.78.34", :primary => true # This is where Rails migrations will run

set :deploy_to, "~/liquid_admin"
set :deploy_via, :export

default_run_options[:pty] = true

namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do

可能是一个愚蠢的时间问,但我想知道我是否需要已经安装了 ruby​​ 和 rails 才能工作。无论如何,我现在就去做......但我只是想知道(不知道 cap 是否适合你。)

但除此之外......为什么它会失败?

git 再次设置并运行良好。推送效果很好。SSH 工作正常。我应该注意的另一件事是,我在运行 ubuntu@22.229.78.34 和仅运行 22.229.78.34 时都尝试了它。我是用 ubuntu 方式做的,因为这通常是亚马逊接受连接的唯一方式。任何帮助,将不胜感激。

4

1 回答 1

1
** [22.229.78.34 :: out] Permission denied (publickey).
** fatal: The remote end hung up unexpectedly

看起来您需要通过 Capistrano 打开的 ssh 连接将您的 Github ssh 密钥转发到 AWS 实例。添加set :ssh_options, { :forward_agent => true }到您的deploy.rb

于 2013-07-03T15:51:06.143 回答