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
alas:
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.
I'm using 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.
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:
/bare-repo/hooks/post-receive:
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
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