接收后挂钩中的git子模块更新将忽略-C

问题描述

我尝试编写一个接收后挂钩来构建静态网页,但是git子模块更新--init命令失败。如果没有通过钩子运行,脚本将成功运行。


OUTPUT=$HOME/post_receive_out

REPO=$HOME/repositories/personal/www_root.git
WORKING_DIR=$HOME/hugo_web_temp
WWW_DIR=/var/www/servers/levente.logonex.eu/pages

echo -ne "This is the post receive hook. I am " > $OUTPUT

whoami >> $OUTPUT

rm -rf $WORKING_DIR
git clone $REPO $WORKING_DIR
git -C $WORKING_DIR submodule update --init

hugo -s $WORKING_DIR/lev -d $WWW_DIR
chmod -R a+r $WWW_DIR

说:

致命:不是git存储库:“。”

现在我用这个来解决它:

cd  $WORKING_DIR
git --git-dir $WORKING_DIR/.git --work-tree $WORKING_DIR submodule update --init

Git submodule update from post-receive hook中找到

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)