Schneems Schneems - 28 days ago 5x
Git Question

Capistrano Deploy fails with git: 'info' is not a git command

I setup a new project with Capistrano and although i can successfully run

cap deploy:setup
if i try to deploy my project I get the error below

→ cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git info -rHEAD"
git: 'info' is not a git command. See 'git --help'.

Did you mean one of these?
*** [deploy:update_code] rolling back

I have several other projects that deploy fine from the same machine however this one will not. Git is installed on my host and target. Does anyone know troubleshooting steps I can take?

My deploy.rb file:

require "bundler/capistrano"
set :application, "baconalyitcs"
set :repository, ""
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, "", :primary => true
role :namenode, ""

after "deploy", "deploy:bundle_gems"
after "deploy", "deploy:print_success_banner"

namespace :deploy do

task :print_success_banner do
puts "---------------------------------------------------"
puts "--------------- DEPLOY SUCCEEDED ------------------"
puts "---------------------------------------------------"

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

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])}"


Update after posting the deploy.rb:

You have to use set :scm, "git" so that it recognizes that you are using git. Hope that helps.

Note, my initial statement on confusion between git and svn is right. It was thinking it was an svn repo, but since you changed the scm_command alone to git, it was trying git info. scm_command I think has to be used only when the scm command is not on path.

info is not a git subcommand like it says.

git: 'info' is not a git command. See 'git --help'.

Did you mean one of these?

clearly, git is installed and fine, but info is not a git command. ( But svn has it, any confusion between git and svn? )