1

I updated "repo" from "computer 1". On "repo", a post-receive hook successfully fires to git checkout -f the changes to "computer 2".

Now, on "computer 2" I want to fire a hook once the above checkout is complete. I have tried a post-receive and a post-checkout hook on "computer 2" but have not been successful. Neither fires. Which hook could I use in this situation on "computer 2"?

punkish
  • 13,598
  • 26
  • 66
  • 101

1 Answers1

0

You cannot just git checkout -f, because that means repo1 is dumping its content on repo2 working tree:

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

What you need is for repo2 to pull repo1 content in order to update its (repo2) content.
Plus, the fact that repo2 initiates the update means that other repo2 hooks will have a chance to be triggered in turn.

 # repo1 post-receive hook
 GIT_DIR=/path/to/repo2/.git
 GIT_WORK_TREE=/path/to/repo2 git pull repo1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250