我使用Capistrano设置了一个新项目,虽然我可以成功运行cap deploy:setup
如果我尝试部署我的项目,我会收到以下错误
→ cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git info git@github.com:foo/Baconalytics.git -rHEAD"
git: 'info' is not a git command. See 'git --help'.
Did you mean one of these?
init
mailinfo
*** [deploy:update_code] rolling back
我有几个其他项目可以在同一台机器上部署,但是这个项目不会。 Git安装在我的主机和目标上。有谁知道我可以采取的故障排除步骤?
我的deploy.rb文件:
require "bundler/capistrano"
set :application, "baconalyitcs"
set :repository, "git@github.com:foo/Baconalytics.git"
set :scm_command, "git"
set :deploy_to, "/root/baconalytics"
set :branch, "master"
set :user, "root"
set :use_sudo, false
ssh_options[:forward_agent] = true
set :deploy_via, :remote_cache
set :ruby_prefix, "/usr/bin/ruby"
set :deploy_user, "#{ENV['USER']}"
role :worker, "xxx.compute-1.amazonaws.com", :primary => true
role :namenode, "xxx.compute-1.amazonaws.com"
after "deploy", "deploy:bundle_gems"
after "deploy", "deploy:print_success_banner"
namespace :deploy do
task :print_success_banner do
puts "---------------------------------------------------"
puts "--------------- DEPLOY SUCCEEDED ------------------"
puts "---------------------------------------------------"
end
task :bundle_gems, :roles => [:worker] do
run "rm -rf /mnt/app/current/vendor/cache; true"
run "if [ -f /mnt/app/current/Gemfile.lock ]; then rm /mnt/app/current/Gemfile.lock; fi;"
cmd = [
"cd #{current_path}",
"#{ruby_prefix}/bundle install",
].join(" && ")
run cmd
end
end
task :ssh do
role = ARGV[1]
servers = @roles[role.to_sym].servers rescue @roles[role.to_sym]
puts instances = `rake ec2:din` unless server
instances = instances.split("\n") unless server
system "ssh -o StrictHostKeyChecking=no root@#{(server || instances[ssh_server.to_i].split("\t")[2])}"
end
答案 0 :(得分:3)
发布deploy.rb后更新:
您必须使用set :scm, "git"
才能识别出您正在使用git。希望有所帮助。
请注意,我关于git
和svn
之间混淆的初步陈述是正确的。它认为这是一个svn回购,但由于你单独将scm_command
更改为git
,它正在尝试git info
。 scm_command
我认为只有在scm命令不在路径上时才能使用。
info
不是像它所说的git子命令。
git: 'info' is not a git command. See 'git --help'.
Did you mean one of these?
init
mailinfo
很明显,git已安装且很好,但info
不是git命令。 (但是svn有它,git和svn之间有任何混淆吗?)
答案 1 :(得分:2)
尝试安装git-info
?
答案 2 :(得分:0)
按照上一个回复:
which git-info
的/ usr /斌/ GIT-信息
rpm -qf /usr/bin/git-info
GIT-额外-4.1.0-1.fc23.noarch
我们至少需要在Fedora Linux中安装git-extras