capistrano无法运行ssh:没有这样的文件或目录

时间:2014-12-27 21:00:28

标签: deployment ssh capistrano

我是capistrano的新手,我正在尝试建立一个测试项目,但正如你猜测的那样,没有太大的成功。当我运行cap deploy:update时,我得到以下输出:

$ cap deploy
  * 2014-12-27 21:48:06 executing `deploy'
  * 2014-12-27 21:48:06 executing `deploy:update'
 ** transaction: start
  * 2014-12-27 21:48:06 executing `deploy:update_code'
    executing locally: "git ls-remote git@github.com:hstandaert/test.git production"
    command finished in 1281ms
  * executing "git clone -q -b production git@github.com:hstandaert/test.git/customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807 && cd /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807 && git checkout -q -b deploy 5604624725df4d3c7dd4f88fc77cfd5d9d8ddf26 && (echo 5604624725df4d3c7dd4f88fc77cfd5d9d8ddf26 > /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807/REVISION)"
servers: ["ssh.stocksolutions.be"]
stocksolutions.be@ssh.stocksolutions.be's password:
stocksolutions.be@ssh.stocksolutions.be's password:
    [ssh.stocksolutions.be] executing command
 ** [ssh.stocksolutions.be :: out] error: cannot run ssh: No such file or directory
 ** [ssh.stocksolutions.be :: out] fatal: unable to fork
    command finished in 1611ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807; true"
    servers: ["ssh.stocksolutions.be"]
    [ssh.stocksolutions.be] executing command
    command finished in 957ms
failed: "sh -c 'git clone -q -b production git@github.com:hstandaert/test.git /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807 && cd /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807 && git checkout -q -b deploy 5604624725df4d3c7dd4f88fc77cfd5d9d8ddf26 && (echo 5604624725df4d3c7dd4f88fc77cfd5d9d8ddf26 > /customers/4/b/b/stocksolutions.be/httpd.www/private/releases/20141227204807/REVISION)'" on ssh.stocksolutions.be

这是deploy.rb文件:

begin
    require 'colored'
rescue LoadError
    $stderr.puts <<-INSTALL
You need the both the capistrano-ext and colored gems to deploy this application
Install the gems like this:
    gem install colored
    INSTALL
    exit 1
end

set :application, "stocksolutions"
set :repository,  "git@github.com:hstandaert/test.git"
set :branch, "production"

set :user, 'stocksolutions.be'
set :deploy_to, "/customers/4/b/b/#{user}/httpd.www/private"
set :use_sudo, false

set :scm, :git

default_run_options[:pty] = true

server "ssh.stocksolutions.be", :app, :web

namespace :deploy do
 task :start do ; end
 task :stop do ; end
 task :restart, :roles => :app, :except => { :no_release => true } do
   run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
 end
end

任何可以发现我错误的人?

1 个答案:

答案 0 :(得分:1)

您的日志似乎表明您的部署服务器中没有安装ssh客户端,或者在服务器的PATH中找不到该命令。

尝试通过https而不是ssh克隆repo将会起作用,方法是更改​​以下内容:

set :repository,  "git@github.com:hstandaert/test.git"

set :repository,  "https://github.com/hstandaert/test.git"

您将被要求提供github的登录凭据,以便能够克隆回购。