2012-10-05 38 views
0

我正试图在Linode上设置我的Rails应用程序,而我正处于试图获得Capistrano设置的阶段。用capistrano进行部署并且'主机密钥验证失败'。 promble

我在与部署位置相同的服务器上安装了git服务器。我有我的SSH密钥设置(我认为) - 至少我可以在没有问题的SSH。

'cap deploy:setup'和'cap deploy:check'运行没有错误。

但是当我尝试运行 '上限部署:迁移' 我得到如下:

[email protected]:~/mini-saler$ cap deploy:migrations 
    * executing `deploy:migrations' 
    * executing `deploy:update_code' 
    updating the cached checkout on all servers 
    executing locally: "git ls-remote [email protected]:mini-saler.git master" 
    command finished in 12446ms 
    * executing "if [ -d /home/railsu/bianbian.com/shared/cached-copy ]; then cd /home/railsu/bianbian.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 8e8aa8f849a9438851a3767b338ab711d6470299 && git clean -d -x -f; else git clone [email protected]:mini-saler.git /home/railsu/bianbian.com/shared/cached-copy && cd /home/railsu/bianbian.com/shared/cached-copy && git checkout -b deploy 8e8aa8f849a9438851a3767b338ab711d6470299; fi" 
    servers: ["XX.207.243.215"] 
    [XX.207.243.215] executing command 
** [XX.207.243.215 :: out] Cloning into /home/railsu/bianbian.com/shared/cached-copy... 
** [XX.207.243.215 :: err] Host key verification failed. 
** [XX.207.243.215 :: err] fatal: The remote end hung up unexpectedly 
    command finished in 2009ms 
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3' -c 'if [ -d /home/railsu/bianbian.com/shared/cached-copy ]; then cd /home/railsu/bianbian.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 8e8aa8f849a9438851a3767b338ab711d6470299 && git clean -d -x -f; else git clone [email protected]:mini-saler.git /home/railsu/bianbian.com/shared/cached-copy && cd /home/railsu/bianbian.com/shared/cached-copy && git checkout -b deploy 8e8aa8f849a9438851a3767b338ab711d6470299; fi'" on XX.207.243.215 

deploy.rb

set :user, 'railsu' 
set :domain, 'XX.207.243.215' 
set :application, 'mini-saler' 
# adjust if you are using RVM, remove if you are not 
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) 
require "rvm/capistrano" 
set :rvm_ruby_string, '1.9.3' 
set :rvm_type, :user 
# file paths 
set :repository, "[email protected]#{domain}:mini-saler.git" 
set :deploy_to, "/home/railsu/bianbian.com" 
# distribute your applications across servers (the instructions below put them 
# all on the same server, defined above as 'domain', adjust as necessary) 
role :app, domain 
role :web, domain 
role :db, domain, :primary => true 


# miscellaneous options 
set :deploy_via, :remote_cache 
set :scm, 'git' 
set :branch, 'master' 
set :scm_verbose, true 
set :use_sudo, false 
set :rails_env, :production 

namespace :deploy do 
    desc "cause Passenger to initiate a restart" 
    task :restart do 
    run "touch #{current_path}/tmp/restart.txt" 
    end 
    desc "reload the database with seed data" 
    task :seed do 
    run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}" 
    end 
end 

after "deploy:update_code", :bundle_install 
desc "install the necessary prerequisites" 
task :bundle_install, :roles => :app do 
    run "cd #{release_path} && bundle install" 
end 

我可以使用ssh连接我的VPS。

回答

2

我不记得是否在cap deploy:setupcap deploy:check上调用了任何git命令 - 我不认为它有。

假设您使用的是gitolite,请检查以确保您的配置具有您的railsu用户的公钥位于keydir目录中。

或者代理转发是你想要的? Deploying with Capistrano可以帮助你。

相关问题