Reputation: 515
We have:
When something pushed in first project (1), I need to pull these changes to other remote repositories (2).
I can pull from first repo and push to destination repositories.
What is the simplest way to do this ?
Thanks.
Upvotes: 2
Views: 1136
Reputation: 467151
You could clone a new bare mirror repository from the upstream repository that you have no control over, e.g. with:
git clone --bare --mirror git://github.com/whoever/whatever.git
(In fact, --mirror
implies --bare
, so --bare
isn't strictly necessary.) The --mirror
option says that rather than just take the local branches from the remote and make them remote-tracking branches, git should mirror all the branches from the remote repository with the same names.
Then, you can set up a frequent cron job that runs the following commands in that repository:
git remote update
git push --mirror --force repo1
git push --mirror --force repo2
This assumes that you've added repo1
and repo2
as remotes, and that they point to bare repositories that you're only wanting to use as mirrors. (The latter requirement is because you're using --force
, so if other people are pushing their work to repo1
or repo2
, it'll get overwritten by the automated mirror pushes.)
Upvotes: 2
Reputation: 526583
You could set up a post-receive
hook in the first remote repository that then pushes from your first remote repository to each of the others.
Upvotes: 2