I'm trying to update automatically my submodule located in var/www/php/vendor/projectX
at each commit to the var/www
super-project. I added these lines in the .git/hooks/post-receive
file :
#!/bin/sh
echo "Updating submodules recursively"
pwd
git submodule update --init --recursive
But I get this when I commit to the super-project :
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 346 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Updating submodules recursively
remote: /var/www/.git
remote: No submodule mapping found in .gitmodules for path 'php/vendor/projectX'
To [email protected]:.
3dc2404..bc46dd6 dev -> dev
The appropriate section is present in the .gitmodules file however, and so are the files in .git/modules. Running git submodule update --init --recursive
manually works fine. It's only when run from the hook that it does not work. Thank you
Try and :
That would give in your post-receive hook script:
cd /var/www/
git --git-dir=/var/www/.git --work-tree=/var/www submodule update --init --recursive
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