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 ?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With