部署 cap 時會 ssh 至本機?

jspaper · 2012年11月28日 · 最后由 jspaper 回复于 2012年12月02日 · 2274 次阅读

利用 cap deploy 時會卡在,它不知為何會 ssh 至本機,先前本來正常,但因為換了新的 repository server 後,它就變這樣了。被這個問題困擾好幾天,也試過重設 id_rsa 和把 repository 改到 github,電腦也重裝過,但都會出現這個問題。

麻煩大家了,謝謝。

以下111.111.111.111是 stage server, 222.222.222.222是 local 中間有一段它會 ssh 至 local??

require "bundler/capistrano"

server "111.111.111.111", :web, :app, :db, primary: true

set :application, "wed"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "gitosis@stagehost:rb_test.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup"

namespace :deploy do
  # ...
end
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote gitosis@stagehost:rb_test.git master"
    command finished in 2889ms
  * executing "if [ -d /home/deployer/apps/wed/shared/cached-copy ]; then cd /home/deployer/apps/wed/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard a1be4e90bf77800700237adb054961d67efeb974 && git clean -q -d -x -f; else git clone -q gitosis@stagehost:rb_test.git /home/deployer/apps/wed/shared/cached-copy && cd /home/deployer/apps/wed/shared/cached-copy && git checkout -q -b deploy a1be4e90bf77800700237adb054961d67efeb974; fi"
    servers: ["111.111.111.111"]
    [111.111.111.111] executing command
 ** [111.111.111.111 :: out] ssh: connect to host 222.222.222.222 port 22: Connection refused
 ** [111.111.111.111 :: out] fatal: The remote end hung up unexpectedly
    command finished in 1584ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/wed/releases/20121128103742; true"
    servers: ["111.111.111.111"]
    [111.111.111.111] executing command
    command finished in 403ms
failed: "sh -c 'if [ -d /home/deployer/apps/wed/shared/cached-copy ]; then cd /home/deployer/apps/wed/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard a1be4e90bf77800700237adb054961d67efeb974 && git clean -q -d -x -f; else git clone -q gitosis@stagehost:rb_test.git /home/deployer/apps/wed/shared/cached-copy && cd /home/deployer/apps/wed/shared/cached-copy && git checkout -q -b deploy a1be4e90bf77800700237adb054961d67efeb974; fi'" on 111.111.111.111

stagehost 在你要部署的目标机器上,会解析到哪个 ip?

hi @pzgz, stagehost 和 gitosis 都是111.111.111.111, thanks.

最後找不到解答,重灌 server 就好了。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号