Client git shooting

I updated the "repo" with "computer 1". On the "repo" hook, it post-receivesuccessfully triggers git checkout -fchanges to "computer 2".

Now, on "computer 2", I want to start the hook as soon as the above verification is complete. I tried the hook post-receiveand post-checkouton "computer 2", but was not successful. Not a fire. What hook can be used in this situation on "computer 2"?

+1
source share
1 answer

You cannot just git checkout -fbecause this means that repo1 flushes its contents on the repo2 working tree:

 # repo1 post-receive hook
 GIT_WORK_TREE=/path/to/repo2 git checkout -f

repo2, repo1, (repo2) .
, , repo2 , , repo2 .

 # repo1 post-receive hook
 GIT_DIR=/path/to/repo2/.git
 GIT_WORK_TREE=/path/to/repo2 git pull repo1
0

All Articles