1

I have one remote repository and two remote repos in two different systems.

In one system, I will modify and push the code to a remote repo.
How can I update the code in another local repo automatically using git hooks?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

1

If you have one local repo pushing to a remote repo, and want a second remote repo to be updated, you need to set a post-update hook in the first remote repo (as in this answer for instance)

ssh git@firstRemoteRepoServer
cd /path/to/remote/repoA.git/hooks (#bare repository)
git remote add B /url/to/remote/bare/repoB.git
echo "git push --mirror B" > post-receive
chmod 755 post-receive
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250