cap deploy:冷却失败,“没有这样的文件或目录 - git rev-parse master”错误

时间:2010-08-18 22:24:44

标签: ruby-on-rails windows github capistrano

我正在尝试首次部署我的rails应用程序。

服务器正在运行Ubuntu 10.4服务器(64位)
本地计算机正在运行Windows XP 存储库位于github

我已成功运行

cap deploy:setup

但是当我跑步时

cap deploy:cold

我收到以下错误:

D:\Rails\rails_apps\fx>cap deploy:cold
You are running Ruby 1.8.6, which has a bug in its threading implementation.
You are liable to encounter deadlocks running Capistrano, unless you install
the fastthread library, which is available as a gem:  
   gem install fastthread  
  * executing `deploy:cold'  
  * executing `deploy:update'  
 ** transaction: start  
  * executing `deploy:update_code'  
    updating the cached checkout on all servers  
*** [deploy:update_code] rolling back  
  * executing "rm -rf /var/www/fx/releases/20100818215651; true"  
    servers: ["pragmaticriskmanagement.gotdns.com"]  
    [pragmaticriskmanagement.gotdns.com] executing command  
    command finished  
D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in ``': No such file or directory - git rev-parse master (Errno::ENOENT)
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in `load'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:87:in `with_env'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in `load'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistran/recipes/deploy/scm/git.rb:154:in `query_revision'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `send'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:63:in `local'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'  
         ... 39 levels...  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/cli/execute.rb:14:in `execute'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/bin/cap:4 
        from D:/Rails/ruby/bin/cap:19:in `load'  
        from D:/Rails/ruby/bin/cap:19  

这是我的'deploy.rb'文件

set :application, "fx"  #"pragmaticriskmanagement.gotdns.com"
set :repository,  "git@github.com:jmedding/Fx.git"
set :deploy_to, "/var/www/#{application}"

set :git_enable_submodules, 1         # Make sure git submodules are populated

set :location, "pragmaticriskmanagement.gotdns.com"

set :user, "xxxxx"
set :use_sudo, false

set :scm, :git

role :app, location #"your app-server here"
role :web, location #"your web-server here"
role :db,  location,    :primary => true #"your db-server here", :primary => true

namespace :deploy do
    desc "Restart Application"
    task :restart, :roles => :app do
      run "touch #{current_path}/tmp/restart.txt"
    end

    desc "Make symlink for database.yml" 
    task :symlink_dbyaml do
      run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" 
    end

    desc "Create empty database.yml in shared path" 
    task :create_dbyaml do
      run "mkdir -p #{shared_path}/config" 
      put '', "#{shared_path}/config/database.yml" 
    end
end

  after 'deploy:setup', 'deploy:create_dbyaml'
  after 'deploy:update_code', 'deploy:symlink_dbyaml'

  after "deploy", "deploy:cleanup"

现在我被卡住了......

非常感谢任何帮助。

谢谢,
乔恩

2 个答案:

答案 0 :(得分:1)

很抱歉重新获得这样一个旧线程,但我通过将我的git二进制文件的默认位置(C:\ Program Files(x86)\ Git \ bin)添加到我的PATH变量来解决这个问题。

答案 1 :(得分:0)

好的,我已经取得了一些进展。

似乎错误表明在本地系统上找不到git ls-remote命令(win xp)。作为测试,我打开了GIT Bash shell并尝试了命令 - 它有效。接下来,我试过

cap deploy 
来自GIT Bash shell的

。没有找到指令。好的,我添加了我的rails路径

  

d:\滑轨\红宝石\ BIN

到windows'path'变量。现在,试试

cap deploy
来自bash shell的

。这似乎解决了这个问题,现在导致我的下一个问题

** [xxxxxxxx.com :: out] Cloning into /var/www/fx/shared/cached-copy...
** [xxxxxxxx.com :: err] Permission denied (publickey).
** [xxxxxxxx.com :: err] fatal: The remote end hung up unexpectedly

我可以使用相同的公钥从我的linux框中成功运行cap deploy。此外,我可以用这把钥匙从这台笔记本电脑推送到我的Github回购。当然,问题的关键应该在服务器上,但如果我从linux盒子里运行'cap',它为什么不能从这里运行呢?