0

I currently have one git repository on serverA mirrored to serverB. I am doing this by periodically pulling from serverA and "push --mirror" to serverB. Both repository are the same.

Unfortunatlty, some developpers only have access to serverB, and cannot contribute to the project because they don't have access to serverA. I would like to allow them push code to serverB, and get those changes mirrored to serverA. (the opposite is also true, some developers only have access to serverA)

What I need:

If a developer pushes code to ServerB, I want the code to automatically appear on ServerA.

If a developer pushes code to ServerA, I want the code to automatically appear on ServerB.

Any idea on how to do this?

Many thanks. G

  • doesn't make sense at all. Why to separate it in two servers when both users have access to the same code? – iberbeu Jan 27 '15 at 16:04
  • I know, it's twisted, but it's due to permission restrictions. ServerA is the main internal git server of the company. ServerB was setup for contractors. ServerA and B are not on the same network, not connected to the same LDAP server – Georges Chaudy Jan 27 '15 at 16:15
  • "some developpers only have access to serverB, and cannot contribute to the project because they don't have access to serverB"... Huh? That seems a bit inconsistent... Either they have access or they don't... – twalberg Jan 27 '15 at 18:11
  • 1
    Possible duplicate of [Gitlab repository mirroring](http://stackoverflow.com/questions/14288288/gitlab-repository-mirroring) – Scott Weldon Sep 19 '16 at 22:00
  • In addition, how is this different from [this question](//stackoverflow.com/q/26463684/2747593), which you asked a few months earlier? – Scott Weldon Sep 19 '16 at 22:02

1 Answers1

0

You can probably do what you want with a post-receive hook on serverB and serverA, though dealing with inevitable conflicts will be... interesting. I'm not going to go into that more because the whole idea defeats itself.

Automatically pushing all changes from serverB to serverA defeats the point of having separate servers for security/permissions. All the people on serverB can alter serverA, all the changes on serverA will show up on serverB. What's the point? You might as well just give everyone access to serverA and save yourself a lot of headache.

Since serverB can talk to serverA, set up a network tunnel on serverB to serverA and vice versa. You can use an SSH tunnel or HTTP proxy as appropriate.

Schwern
  • 153,029
  • 25
  • 195
  • 336