git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git: How to keep multiple bare repos in sync?
@ 2015-05-13  4:09 chenxitwo
  2015-05-13  4:37 ` Junio C Hamano
  2015-05-14 13:11 ` Konrad Scherer
  0 siblings, 2 replies; 6+ messages in thread
From: chenxitwo @ 2015-05-13  4:09 UTC (permalink / raw)
  To: git

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.






chenxitwo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git: How to keep multiple bare repos in sync?
  2015-05-13  4:09 Git: How to keep multiple bare repos in sync? chenxitwo
@ 2015-05-13  4:37 ` Junio C Hamano
  2015-05-13  7:01   ` chenxitwo
  2015-05-14 13:11 ` Konrad Scherer
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2015-05-13  4:37 UTC (permalink / raw)
  To: chenxitwo; +Cc: git

chenxitwo <chenxitwo@126.com> writes:

> 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.

rsync?

The problem is under-specified.  Is there one of them that is
authoritative and that the other ones should match its progress?
If so, perhaps push from the authoritative one to the other two
with "push --mirror" (or have the other ones "fetch --mirror")?

If you are allowing people to push into any of them randomly,
then there is no general solution.  If I push an update to 'master'
of instance A while you update the same 'master' branch of instance
B, somebody has to reconcile the divergence between the two by
creating a merge, and that can possibly conflict, needing human
intervention to resolve.
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git: How to keep multiple bare repos in sync?
  2015-05-13  4:37 ` Junio C Hamano
@ 2015-05-13  7:01   ` chenxitwo
  2015-06-03  1:55     ` chenxitwo
  0 siblings, 1 reply; 6+ messages in thread
From: chenxitwo @ 2015-05-13  7:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

not remote sync.  

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?



chenxitwo

From: Junio C Hamano
Date: 2015-05-13 12:37
To: chenxitwo
CC: git
Subject: Re: Git: How to keep multiple bare repos in sync?
chenxitwo <chenxitwo@126.com> writes:

> 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.

rsync?

The problem is under-specified.  Is there one of them that is
authoritative and that the other ones should match its progress?
If so, perhaps push from the authoritative one to the other two
with "push --mirror" (or have the other ones "fetch --mirror")?

If you are allowing people to push into any of them randomly,
then there is no general solution.  If I push an update to 'master'
of instance A while you update the same 'master' branch of instance
B, somebody has to reconcile the divergence between the two by
creating a merge, and that can possibly conflict, needing human
intervention to resolve.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git: How to keep multiple bare repos in sync?
  2015-05-13  4:09 Git: How to keep multiple bare repos in sync? chenxitwo
  2015-05-13  4:37 ` Junio C Hamano
@ 2015-05-14 13:11 ` Konrad Scherer
  1 sibling, 0 replies; 6+ messages in thread
From: Konrad Scherer @ 2015-05-14 13:11 UTC (permalink / raw)
  To: chenxitwo, git

On 2015-05-13 12:09 AM, chenxitwo wrote:
> 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.

I am using grokmirror[1] to mirror 600+ git repositories across three 
datacenters. It syncs quickly and efficiently. The setup is a bit 
complicated (it requires python, python git libraries and a webserver). 
There are packages for Fedora. It all depends on how many repos you are 
trying to mirror.

[1]: https://github.com/mricon/grokmirror

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git: How to keep multiple bare repos in sync?
  2015-05-13  7:01   ` chenxitwo
@ 2015-06-03  1:55     ` chenxitwo
  2015-06-03  4:10       ` David Lang
  0 siblings, 1 reply; 6+ messages in thread
From: chenxitwo @ 2015-06-03  1:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Konrad Scherer,
	Thanks for your reply.
 
	But git mirror is helpless for me.
	I have an idea about two repos' sync. However there is a problem with this is how to prevent other usrs' push operation.
 
	Details as follows:
	Team A, B have their own git server repos, respectively repos_A, repos_B.
	step1: 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)
	step2: After the repos_A is updated, the repos_A will send push request to the repos_B.
	step3: After the repos_B is updated, the repos_A will unlock the repos_B.
 
	Problem: How to lock git remote repos to prevent other usrs' push operation.
 


--------------
chenxitwo
>not remote sync.  
>
>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?
>
>
>
>chenxitwo
>
>From: Junio C Hamano
>Date: 2015-05-13 12:37
>To: chenxitwo
>CC: git
>Subject: Re: Git: How to keep multiple bare repos in sync?
>chenxitwo <chenxitwo@126.com> writes:
>
>> 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.
>
>rsync?
>
>The problem is under-specified.  Is there one of them that is
>authoritative and that the other ones should match its progress?
>If so, perhaps push from the authoritative one to the other two
>with "push --mirror" (or have the other ones "fetch --mirror")?
>
>If you are allowing people to push into any of them randomly,
>then there is no general solution.  If I push an update to 'master'
>of instance A while you update the same 'master' branch of instance
>B, somebody has to reconcile the divergence between the two by
>creating a merge, and that can possibly conflict, needing human
>intervention to resolve.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git: How to keep multiple bare repos in sync?
  2015-06-03  1:55     ` chenxitwo
@ 2015-06-03  4:10       ` David Lang
  0 siblings, 0 replies; 6+ messages in thread
From: David Lang @ 2015-06-03  4:10 UTC (permalink / raw)
  To: chenxitwo; +Cc: Junio C Hamano, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3353 bytes --]

On Wed, 3 Jun 2015, chenxitwo wrote:

> Hi Konrad Scherer,
> 	Thanks for your reply.
>
> 	But git mirror is helpless for me.
> 	I have an idea about two repos' sync. However there is a problem with this is how to prevent other usrs' push operation.
>
> 	Details as follows:
> 	Team A, B have their own git server repos, respectively repos_A, repos_B.
> 	step1: 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)
> 	step2: After the repos_A is updated, the repos_A will send push request to the repos_B.
> 	step3: After the repos_B is updated, the repos_A will unlock the repos_B.
>
> 	Problem: How to lock git remote repos to prevent other usrs' push operation.

you can't lock the remote repos to prevent pushes to them.

This is the problem that Junio was referring to when he said that if people are 
pushing to all repos there is no general solution.

What you will need to do is to have someone reconcile the differences between 
the different repos periodically.

However, stepping back a bit. Why is it that you say that you don't have enough 
bandwidth between the sites? If you have the developers working with a local 
clone on their workstation, the bandwidth needed after the initial clone should 
be pretty low.

In any case, the issue is how much the work of the different developers overlap 
with each other. If they are all changing the same part of the code, you will 
have a problem. But if they are working on different areas, then you can use the 
branch and pull model where the developers do their development locally and then 
push what they have ready to integrate into a local (at least same building) 
repo and send a pull request to whoever is coordinating the changes, and they 
then pull all the different changes and deal with reconciling conflicts between 
them.

David Lang

>
>
> --------------
> chenxitwo
>> not remote sync.
>>
>> 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?
>>
>>
>>
>> chenxitwo
>>
>> From: Junio C Hamano
>> Date: 2015-05-13 12:37
>> To: chenxitwo
>> CC: git
>> Subject: Re: Git: How to keep multiple bare repos in sync?
>> chenxitwo <chenxitwo@126.com> writes:
>>
>>> 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.
>>
>> rsync?
>>
>> The problem is under-specified.  Is there one of them that is
>> authoritative and that the other ones should match its progress?
>> If so, perhaps push from the authoritative one to the other two
>> with "push --mirror" (or have the other ones "fetch --mirror")?
>>
>> If you are allowing people to push into any of them randomly,
>> then there is no general solution.  If I push an update to 'master'
>> of instance A while you update the same 'master' branch of instance
>> B, somebody has to reconcile the divergence between the two by
>> creating a merge, and that can possibly conflict, needing human
>> intervention to resolve.N嫥叉靣笡y???氊b瞂???千v豝???藓{.n???壏爦丕???洝塄}???财爖???j:+v墾???珣赙zZ+€???zf"穐殘???啳嗃i???鄗???畐ア???櫒璀??????撷^[f

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-03  4:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13  4:09 Git: How to keep multiple bare repos in sync? chenxitwo
2015-05-13  4:37 ` Junio C Hamano
2015-05-13  7:01   ` chenxitwo
2015-06-03  1:55     ` chenxitwo
2015-06-03  4:10       ` David Lang
2015-05-14 13:11 ` Konrad Scherer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).