{"thread":{"id":"39319","subject":"Git: How to keep multiple bare repos in sync?","startedAt":"2015-05-13T04:09:10Z","lastAt":"2015-06-03T04:10:58Z","messageCount":6,"participants":["chenxitwo","Junio C Hamano","Konrad Scherer","David Lang"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261117","messageId":"2015051312090840845945@126.com","threadId":"39319","inReplyTo":null,"subject":"Git: How to keep multiple bare repos in sync?","fromName":"chenxitwo","fromEmail":"chenxitwo@126.com","sentAt":"2015-05-13T04:09:10Z","receivedAt":"2015-05-13T04:09:10Z","isPatch":false,"sender":{"key":"chenxitwo@126.com","avatar":null},"body":"There are three git server(bare repos), but i don't know to solve the problem that how to keep these git servers in sync.\n\n\n\n\n\n\nchenxitwo"},{"id":"261120","messageId":"xmqq4mnhccti.fsf@gitster.dls.corp.google.com","threadId":"39319","inReplyTo":"2015051312090840845945@126.com","subject":"Re: Git: How to keep multiple bare repos in sync?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-13T04:37:45Z","receivedAt":"2015-05-13T04:37:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"chenxitwo <chenxitwo@126.com> writes:\n\n> There are three git server(bare repos), but i don't know to solve the\n> problem that how to keep these git servers in sync.\n\nrsync?\n\nThe problem is under-specified.  Is there one of them that is\nauthoritative and that the other ones should match its progress?\nIf so, perhaps push from the authoritative one to the other two\nwith \"push --mirror\" (or have the other ones \"fetch --mirror\")?\n\nIf you are allowing people to push into any of them randomly,\nthen there is no general solution.  If I push an update to 'master'\nof instance A while you update the same 'master' branch of instance\nB, somebody has to reconcile the divergence between the two by\ncreating a merge, and that can possibly conflict, needing human\nintervention to resolve.\n \n"},{"id":"261135","messageId":"2015051315014048836362@126.com","threadId":"39319","inReplyTo":"xmqq4mnhccti.fsf@gitster.dls.corp.google.com","subject":"Re: Git: How to keep multiple bare repos in sync?","fromName":"chenxitwo","fromEmail":"chenxitwo@126.com","sentAt":"2015-05-13T07:01:42Z","receivedAt":"2015-05-13T07:01:42Z","isPatch":false,"sender":{"key":"chenxitwo@126.com","avatar":null},"body":"not remote sync.  \n\nWe have three teams to participate in the same project, and is located in different places. Bandwidth that between the two of our teams is not enough. Three teams have their own git server. Like this kind of situation, how should handle?\n\n\n\nchenxitwo\n\nFrom: Junio C Hamano\nDate: 2015-05-13 12:37\nTo: chenxitwo\nCC: git\nSubject: Re: Git: How to keep multiple bare repos in sync?\nchenxitwo <chenxitwo@126.com> writes:\n\n> There are three git server(bare repos), but i don't know to solve the\n> problem that how to keep these git servers in sync.\n\nrsync?\n\nThe problem is under-specified.  Is there one of them that is\nauthoritative and that the other ones should match its progress?\nIf so, perhaps push from the authoritative one to the other two\nwith \"push --mirror\" (or have the other ones \"fetch --mirror\")?\n\nIf you are allowing people to push into any of them randomly,\nthen there is no general solution.  If I push an update to 'master'\nof instance A while you update the same 'master' branch of instance\nB, somebody has to reconcile the divergence between the two by\ncreating a merge, and that can possibly conflict, needing human\nintervention to resolve."},{"id":"261234","messageId":"55549F00.5030101@windriver.com","threadId":"39319","inReplyTo":"2015051312090840845945@126.com","subject":"Re: Git: How to keep multiple bare repos in sync?","fromName":"Konrad Scherer","fromEmail":"konrad.scherer@windriver.com","sentAt":"2015-05-14T13:11:28Z","receivedAt":"2015-05-14T13:11:28Z","isPatch":false,"sender":{"key":"konrad.scherer@windriver.com","avatar":null},"body":"On 2015-05-13 12:09 AM, chenxitwo wrote:\n> There are three git server(bare repos), but i don't know to solve the\n> problem that how to keep these git servers in sync.\n\nI am using grokmirror[1] to mirror 600+ git repositories across three \ndatacenters. It syncs quickly and efficiently. The setup is a bit \ncomplicated (it requires python, python git libraries and a webserver). \nThere are packages for Fedora. It all depends on how many repos you are \ntrying to mirror.\n\n[1]: https://github.com/mricon/grokmirror\n"},{"id":"262804","messageId":"201506030955200885513@126.com","threadId":"39319","inReplyTo":"2015051315014048836362@126.com","subject":"Re: Git: How to keep multiple bare repos in sync?","fromName":"chenxitwo","fromEmail":"chenxitwo@126.com","sentAt":"2015-06-03T01:55:21Z","receivedAt":"2015-06-03T01:55:21Z","isPatch":false,"sender":{"key":"chenxitwo@126.com","avatar":null},"body":"Hi Konrad Scherer,\n\tThanks for your reply.\n \n\tBut git mirror is helpless for me.\n\tI have an idea about two repos' sync. However there is a problem with this is how to prevent other usrs' push operation.\n \n\tDetails as follows:\n\tTeam A, B have their own git server repos, respectively repos_A, repos_B.\n\tstep1: The repos_A locking repos_B When repos_A received Team_A requests to push, and repos_B can't accept other users' push request. (use pre-receive hook)\n\tstep2: After the repos_A is updated, the repos_A will send push request to the repos_B.\n\tstep3: After the repos_B is updated, the repos_A will unlock the repos_B.\n \n\tProblem: How to lock git remote repos to prevent other usrs' push operation.\n \n\n\n--------------\nchenxitwo\n>not remote sync.  \n>\n>We have three teams to participate in the same project, and is located in different places. Bandwidth that between the two of our teams is not enough. Three teams have their own git server. Like this kind of situation, how should handle?\n>\n>\n>\n>chenxitwo\n>\n>From: Junio C Hamano\n>Date: 2015-05-13 12:37\n>To: chenxitwo\n>CC: git\n>Subject: Re: Git: How to keep multiple bare repos in sync?\n>chenxitwo <chenxitwo@126.com> writes:\n>\n>> There are three git server(bare repos), but i don't know to solve the\n>> problem that how to keep these git servers in sync.\n>\n>rsync?\n>\n>The problem is under-specified.  Is there one of them that is\n>authoritative and that the other ones should match its progress?\n>If so, perhaps push from the authoritative one to the other two\n>with \"push --mirror\" (or have the other ones \"fetch --mirror\")?\n>\n>If you are allowing people to push into any of them randomly,\n>then there is no general solution.  If I push an update to 'master'\n>of instance A while you update the same 'master' branch of instance\n>B, somebody has to reconcile the divergence between the two by\n>creating a merge, and that can possibly conflict, needing human\n>intervention to resolve."},{"id":"262805","messageId":"alpine.DEB.2.02.1506022104320.3147@nftneq.ynat.uz","threadId":"39319","inReplyTo":"201506030955200885513@126.com","subject":"Re: Git: How to keep multiple bare repos in sync?","fromName":"David Lang","fromEmail":"david@lang.hm","sentAt":"2015-06-03T04:10:58Z","receivedAt":"2015-06-03T04:10:58Z","isPatch":false,"sender":{"key":"david@lang.hm","avatar":null},"body":"On Wed, 3 Jun 2015, chenxitwo wrote:\n\n> Hi Konrad Scherer,\n> \tThanks for your reply.\n>\n> \tBut git mirror is helpless for me.\n> \tI have an idea about two repos' sync. However there is a problem with this is how to prevent other usrs' push operation.\n>\n> \tDetails as follows:\n> \tTeam A, B have their own git server repos, respectively repos_A, repos_B.\n> \tstep1: The repos_A locking repos_B When repos_A received Team_A requests to push, and repos_B can't accept other users' push request. (use pre-receive hook)\n> \tstep2: After the repos_A is updated, the repos_A will send push request to the repos_B.\n> \tstep3: After the repos_B is updated, the repos_A will unlock the repos_B.\n>\n> \tProblem: How to lock git remote repos to prevent other usrs' push operation.\n\nyou can't lock the remote repos to prevent pushes to them.\n\nThis is the problem that Junio was referring to when he said that if people are \npushing to all repos there is no general solution.\n\nWhat you will need to do is to have someone reconcile the differences between \nthe different repos periodically.\n\nHowever, stepping back a bit. Why is it that you say that you don't have enough \nbandwidth between the sites? If you have the developers working with a local \nclone on their workstation, the bandwidth needed after the initial clone should \nbe pretty low.\n\nIn any case, the issue is how much the work of the different developers overlap \nwith each other. If they are all changing the same part of the code, you will \nhave a problem. But if they are working on different areas, then you can use the \nbranch and pull model where the developers do their development locally and then \npush what they have ready to integrate into a local (at least same building) \nrepo and send a pull request to whoever is coordinating the changes, and they \nthen pull all the different changes and deal with reconciling conflicts between \nthem.\n\nDavid Lang\n\n>\n>\n> --------------\n> chenxitwo\n>> not remote sync.\n>>\n>> We have three teams to participate in the same project, and is located in different places. Bandwidth that between the two of our teams is not enough. Three teams have their own git server. Like this kind of situation, how should handle?\n>>\n>>\n>>\n>> chenxitwo\n>>\n>> From: Junio C Hamano\n>> Date: 2015-05-13 12:37\n>> To: chenxitwo\n>> CC: git\n>> Subject: Re: Git: How to keep multiple bare repos in sync?\n>> chenxitwo <chenxitwo@126.com> writes:\n>>\n>>> There are three git server(bare repos), but i don't know to solve the\n>>> problem that how to keep these git servers in sync.\n>>\n>> rsync?\n>>\n>> The problem is under-specified.  Is there one of them that is\n>> authoritative and that the other ones should match its progress?\n>> If so, perhaps push from the authoritative one to the other two\n>> with \"push --mirror\" (or have the other ones \"fetch --mirror\")?\n>>\n>> If you are allowing people to push into any of them randomly,\n>> then there is no general solution.  If I push an update to 'master'\n>> of instance A while you update the same 'master' branch of instance\n>> B, somebody has to reconcile the divergence between the two by\n>> creating a merge, and that can possibly conflict, needing human\n>> intervention to resolve.N嫥叉靣笡y???氊b瞂???千v豝???藓{.n???壏爦丕???洝塄}???财爖???j:+v墾???珣赙zZ+€???zf＂穐殘???啳嗃i???鄗???畐ア???櫒璀??????撷\u001bf"}]}