GIT post-accept hook not testing submodules

I was working on a Kohana 3 project, which I installed using a downloaded zip file some time ago. I have a git repository on my remote project.git server that checks the latest commits to the public_html working directory where I am testing the application

My file with an attached message

GIT_WORK_TREE=/var/www/public_html;
git checkout -f;

which worked a couple of months until I decided to delete some kohana folders and use the git submodule instead, so I can do updates through git.

Now the problem is that the submodules are not in the working directory. I tried to go in there to add submodules, but the public_html directory is not a repository. In the "project.git" directory, git commands throw an error that I have to execute in the working directory.

How do I change my hook for checkout subframes when I commit?

Update

As suggested by @manojlds: I added it to the hook, and now it looks like this:

GIT_WORK_TREE=/var/www/public_html;
git submodule init;
git submodule update; 
git checkout -f;

But I get this message,

remote: You need to run this command from the Top level of the working tree

and no changes to submodules in

public_html
+3
source share
2 answers

-: WORK_DIR , . - . git git , . (git , cp -R ) .

#!/bin/sh
unset GIT_DIR
echo "Checking out"
(cd $WORK_DIR && git pull --recurse-submodules=yes --force)
echo "Submodule update..."
(cd $WORK_DIR && git --work-tree="$WORK_DIR" submodule update --init --recursive --force)
+1

( GIT_WORK_TREE):

git submodule init
git submodule update

, public_html

( ):

#!/bin/sh
unset GIT_DIR
git clone /path/to/repo /tmp/public_html
cd /tmp/public_html
git submodule init
git submodule update
cp -R /tmp/public_html /var/www/
rm -rf /tmp/public_html
rm -rf /var/www/public_html/.git
+5

All Articles