I try to write a post-receive hook to build a static webpage, but the git submodule update --init command fails. The script runs successfully when not run by the hook.
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 says:
fatal: not a git repository: '.'
For now I fixed it with this:
cd $WORKING_DIR git --git-dir $WORKING_DIR/.git --work-tree $WORKING_DIR submodule update --init