【问题标题】:Capistrano Deploy fails with git: 'info' is not a git commandCapistrano Deploy 因 git 失败:“info”不是 git 命令
【发布时间】:2011-06-16 02:54:31
【问题描述】:

我使用 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

【问题讨论】:

    标签: git deployment capistrano


    【解决方案1】:

    发布 deploy.rb 后更新:

    您必须使用set :scm, "git" 以便它识别您正在使用 git。希望对您有所帮助。

    请注意,我最初关于 gitsvn 之间混淆的陈述是正确的。它认为这是一个 svn 存储库,但由于您将 scm_command 单独更改为 git,它正在尝试 git infoscm_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有什么混淆吗?)

    【讨论】:

    • 不,我对 git 和 svn 之间的区别并不感到困惑。我很困惑为什么这个 Capistrano 项目会调用这个不存在的命令,而我的其他人不会。
    • @Schneems - 所以当你甚至没有给出 cap 文件 /sn-p 的时候你对我投了反对票?祝你好运。
    • 您的回答尚未证明有帮助。当它发生变化时,我会投票赞成你的答案,以及你留下的任何建设性的 cmets。如果您需要 Capistrano 文件或 sn-p 请询问,您是这里的领域专家,对吗?我想给你分数,几乎就像我想解决这个问题一样,请给我一个理由。
    • 你说得对,我有set :scm_command, "git" 但不是set :scm "git" 谢谢你的帮助!
    【解决方案2】:

    尝试安装git-info

    【讨论】:

    • 我的任何其他 capistrano 部署都不需要 git-info,为什么这个项目需要它?
    • 听起来很讽刺,但却是一个真正的问题。
    【解决方案3】:

    按照上一个回复:

    which git-info 
    

    /usr/bin/git-info

    rpm -qf /usr/bin/git-info 
    

    git-extras-4.1.0-1.fc23.noarch

    我们至少需要在 Fedora Linux 中安装 git-extras

    【讨论】:

      猜你喜欢
      • 2019-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多