我正在尝试设置 capistrano 并想在服务器上测试之前在本地测试我的配置,但是当我运行 cap deploy -n 时,不断收到以下与 git 相关的错误
/Users/josh/.rvm/gems/ruby-1.9.3-p448@wgbh/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/git.rb:234:in `block in query_revision': undefined method `sub' for nil:NilClass (NoMethodError)
并导致如下:
* 2013-08-26 12:12:30 executing `deploy'
* 2013-08-26 12:12:30 executing `deploy:update'
** transaction: start
* 2013-08-26 12:12:30 executing `deploy:update_code'
* executing locally: "git ls-remote git@github.com:GIT_REPO GIT_BRANCH"
*** [deploy:update_code] rolling back
* executing "rm -rf /u/apps/APP_NAME/releases/20130826161230; true"
我试图追溯这一点,但我似乎无法弄清楚是什么原因造成的。我的 deploy.rb 如下所示:
require "bundler/capistrano"
set :application, "APP_NAME"
set :deply_to, "/the/server/path"
set :user, "SERVER_USER"
set :repository, "git@github.com:GIT_REPO_PATH"
set :scm, :git
set :scm_username , "GIT_USER_NAME"
#this allows you to choose a branch in the command line or default to master with 'cap -S branch=branchname deploy'
set :branch, fetch(:branch, "master")
#tells is to do resuse a single remote git clone
set :deploy_via, :remote_cache
server "THE_SERVER_NAME", :app, :web, :db, :primary => true
after 'deploy:update_code', 'deploy:migrate'
# If you are using Passenger mod_rails uncomment this:
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
有没有其他人遇到过这个错误?我找到了这篇文章,但遵循一个建议根本不会改变错误。