10 August 2012

Capistrano + GIT : Too many arguments while deployment

Issue : shell command failed with return code 33024

It's a ruby + git clone + windows issue.

If I chain commands with && while calling system(cmd) from ruby, chaining "git clone" with other commands is not fine. Git clone perceives the chained commands as its own continuation, i.e. as a destination directory, unless I run it from the command line.
As I couldn't find any references or solutions to this problem on the internet, I put a hack to capistrano code, so "git clone" is executed separately. 

In <ruby directory>\lib\ruby\gems\1.8\gems\capistrano-2.5.18\lib\capistrano\recipes\deploy\strategy\base.rb after the line 53 (cmd = cmd.split...)
add the following lines:
if cmd =~ /\s\&\&\s/ && cmd =~ /^git\s+clone/
   cmd1, cmd = cmd.split(" && ", 2)

it checks if it's a chained command and the first command is "git clone", and if such it executes it separately. It may not work for all possible cases.

Also you can try using ubuntu from your local.



  1. I try but still not working.
    I still got the following errors. please advise.
    c:\rails_apps\fruitstore>cap deploy:cold
    * executing `deploy:cold'
    * executing `deploy:update'
    ** transaction: start
    * executing `deploy:update_code'
    executing locally: "git ls-remote c:/rails_apps/fruitstore HEAD"
    command finished in 655ms
    * getting (via checkout) revision 0c64caf189cb496255c6f57eae33748dc0980446 to C:/Users/Kam/AppData/Local/Temp/20120920
    executing locally: git clone -q c:/rails_apps/fruitstore C:/Users/Kam/AppData/Local/Temp/20120920100749 && cd C:/Use
    rs/Kam/AppData/Local/Temp/20120920100749 && git checkout -q -b deploy 0c64caf189cb496255c6f57eae33748dc0980446
    Too many arguments.

  2. please try deploying from a linux machine or a ubuntu virtual machine ! it would work !

  3. Im trying to deploy it from ubuntu 12.04 and still get that error

    executing "git clone -q https://name@bitbucket.org/bucketname/repname.git /u/apps/appname/releases/20130403202136 && cd /u/apps/appname/releases/20130403202136 && git checkout -q -b deploy 299c57c659bd974e71c7faa4895e4cac7aabd2d2 && (echo 299c57c659bd974e71c7faa4895e4cac7aabd2d2 > /u/apps/appname/releases/20130403202136/REVISION)"
    servers: [""]
    [] executing command
    ** [ :: err] Too many arguments.


Any inputs are welcomed : ashish.cse2010@gmail.com