Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github project with submodules cloning capistrano

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 [email protected]: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 ?

like image 501
nivanka Avatar asked Nov 29 '11 04:11

nivanka


People also ask

Does git clone include submodules?

Cloning a Project with Submodules If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.

Is using git submodules a good idea?

Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.


1 Answers

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.

like image 160
KL-7 Avatar answered Nov 07 '22 23:11

KL-7