2

Is possible to clone a git bare repo as a new bare repo ? for example:

  • git init --bare mainRepo.git

Then in a remote server:

  • git clone --bare xxx@server:/path/mainRepo.git repoReplica.git

And then with a cron job send changes from repoReplica.git to mainRepo.git, so I can have 2 teams working, one directly with mainRepo.git and the second with repoReplica.git

Is it possible ? and How ?

MadMad666
  • 955
  • 3
  • 11
  • 19

1 Answers1

-1

It is possible, but I would suggest for your synchronisation process to:

  • not use cron
  • use a post-receive hook which can then push what has been receive to the other repo
  • limit the synchronization to one branch
  • use different branches

Meaning:

  • repo1 would push master to repo2 as master_fromrepo1

    git push repo2 master:master_fromrepo1
    
  • repo2 would push master to to repo1 as master_fromrepo2

    git push repo1 master:master_fromrepo2
    
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • thanks @VonC, I've to read to use that. But, Why Do you suggest to use different branches ? – MadMad666 Jun 30 '14 at 06:14
  • @MadMad666 to ensure fast-forward push, instead of potential merge conflicts if one unique branch is used for pushing from both repos. – VonC Jun 30 '14 at 06:25