'Push to deploy' post-receive hook that includes submodules?
Currently, I have a
post-receive hook that contains:
git --work-tree=/served/data/location --git-dir=/this/bare/git/repo checkout -f
That worked great, until I wanted to include a submodule, which it just ignores.
After a bit of reading, I thought I could simply add:
git --work-tree=/served/data/location --git-dir=/this/bare/git/repo submodule update --init --recursive
git-submodule cannot be used without a working tree
Odd, since I’ve plainly supplied the same
--work-tree as for the prior checkout, which worked fine.
git version 2.7.4 on the server, and pushing with
git version 2.11.0.
As far as I can tell, this is the same issue as here, except that talks about something called ‘OpenShift’ that I’ve never heard of and am not using, so the answer doesn’t really help.
One Solution collect form web for “'Push to deploy' post-receive hook that includes submodules?”
For some reason, the command needed to be run from inside the work tree, not the bare git directory, even though both arguments are supplied:
git --work-tree=/served-data --git-dir=/bare-repo checkout -f cd /served-data git --work-tree=/served-data --git-dir=/bare-repo submodule update --init --recursive