Reputation: 101
I have Network A
and Network B
.
Stash
runs on A
and Gitlab
runs on B
but they cannot communicate across networks.
1 group of developers actively work on A
and the other group of developers actively work on B
.
I have a machine that can see both.
So, daily I would like to be able to pull all updates, branches and tags from A
and push to B
, in reverse I would like to pull all updates, branches and tags from B
and push to A
.
I have cloned from A
and added an additionl remote
git remote add networkb git@<ip-address>:group/project.git
So now I have git remote -v
:
networkb git@<networkb-ip-address>:group/project.git (fetch)
networkb git@<networkb-ip-address>:group/project.git (push)
origin git@<networka-ip-address>:group/project.git (fetch)
origin git@<networka-ip-address>:group/project.git (push)
git push networkb --all
only works for locally checked out branches.git push networkb '*:*'
pushed everything to B
but I cannot see branches when checkout fromgit push networkb +refs/remtes/origin/*:refs/heads/*
worked for initial push but will result in a force push if run again.Could anyone provide a sequence of steps to keeping these 2 remote repositories in sync?
Upvotes: 2
Views: 76
Reputation: 51850
Inside your intermediate repository, you can the list of branch on origin using :
git for-each-ref --format="%(refname:short)" refs/remotes/origin
(change origin
to networkb
to get branches on networkb).
You can iterate through this list to either blindly push to networkb,
or try to first run a merge to see if any conflicts will happen,
or create networka/branches
on networkb
and and networkb/branches
on networka
.
Upvotes: 1