Alex Rivera | Logout

github project with submodules cloning capistrano

Asked 2011-11-29T04:58:33.787
8

i am trying to build a capistrano deplyoment script for a git project which has a submodule.

I am running these commands

run "git clone git@github.com:GITPROJECT /var/www/myfolder"

when i run this the submodule wont clone to /var/www/myfolder instead it only creates an empty folder with the name of the submodule

when I try to run this it wont work either

run "cd /var/www/myfolder/submodule && git pull master"

can someone help me with this please ?

Edit
Report

1 Answer

19

Basically what you need is

set :git_enable_submodules, 1

option in your deploy.rb script. It tells capistrano to init and update git submodules after fetching source from the main repo. If for some reason you want to do it manually you can run that from the root directory of your project:

git submodule update --init

though, if I remember correctly, --init is not available in some older versions of git so if it doesn't work you can do it like that:

git submodule init && git submodule update

Have a look at this answer for more extensive explanation about git options for capistrano.

answered 2011-11-29T06:54:51.453

Your Answer