'Push to deploy'包含子模块的post-receive hook? [英] 'Push to deploy' post-receive hook that includes submodules?
问题描述
目前,我有一个 post-receive
钩子,其中包含:
git --work-tree = / serve / data / location --git-dir = / this / bare / git / repo checkout -f
这很好,直到我想包含一个子模块,它只是忽略它。
经过一番阅读,我我认为我可以简单地添加:
$ p $ g $ git --work-tree = / serve / data / location --git-dir = /这个/ bare / git / repo子模块更新--init --recursive
alas:
git-submodule不能在没有工作树的情况下使用
奇怪,因为我已经清楚地提供了与之前结账相同的 - work-tree
,这很好。
我在服务器上使用 git version 2.7.4
,并使用 git version 2.11.0
。
据我所知,这是与此处相同的问题,只是讨论了一些我从未听说过但没有使用过的名为OpenShift的内容,所以答案并没有真正的帮助。
由于某些原因,即使提供了两个参数,该命令也需要从工作树内运行,而不是裸露的git目录。
/ 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子模块更新--init - 递归
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
这篇关于'Push to deploy'包含子模块的post-receive hook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!