Search code examples
gitgit-pushgit-pull

How to keep 2 git repositories in sync automatically


Having 2 servers which should be in sync with eachothers at all times.

As someone pushes something to the repository of server A, the repository on server B should be updated automatically, depending what server is the master/slave.

Both servers are not on the same machine.

Is this possible without having to run additional manual commands every update? (git fetch etc.) Or do you advise a different mechanism?


Solution

  • You could use a post-receive or update Git Hook to push between repositories.