簡體   English   中英

使用capistrano進行部署並且“主機密鑰驗證失敗”。 promble

[英]Deploying with capistrano and 'Host key verification failed.' promble

我正在嘗試在Linode上設置我的Rails應用程序,而我正在嘗試設置Capistrano。

我在與我部署的服務器相同的服務器上安裝了git服務器。 我有SSH密鑰設置(我認為) - 至少我可以SSH沒問題。

'cap deploy:setup'和'cap deploy:check'都可以正常運行而不會出錯。

但是當我嘗試運行'cap deploy:migrations'時,我得到以下內容:

ray@ray-ThinkPad-SL:~/mini-saler$ cap deploy:migrations
  * executing `deploy:migrations'
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@XX.207.243.215: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 git@XX.207.243.215: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 git@XX.207.243.215: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, "git@#{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。

我不記得是否在cap deploy:setup上調用了任何git命令cap deploy:setupcap deploy:check - 我認為沒有。

假設您使用的是gitolite,請檢查以確保您的配置中railsu用戶的公鑰位於keydir目錄中。

或者代理轉發可能是你想要的? 與Capistrano一起部署可以幫助您。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM