I have 2 bare repositories. They are made like this:
ssh git@primary.com
git init --bare repo1
ssh git@backup.com
git clone --bare git@primary.com:repo1
One is used for development (let's call it primary) and one is used for backup (in case first is not accessible). Is it possible to automatically synchronize them - something like doing git pull
on backup.
I guess you can't merge or pull on bare repository. Is there another way to have backup repository up to date, rather than this:
ssh git@backup.com
rm repo1 -fr
git clone -- bare git@primary.com:repo1
of course when primary wasn't accessible for a while and I used backup then I would want to update primary.
Also adding 2 remotes to the working repository is a solution, but you have to constantly push to the both of them, which can't happen if one is inaccessible.
All conflicts are resolved in the non-bare repositories
edit why do I need backup repository:
we use remote repository to exchange code and it's needed daily. usually people don't need code written by other developers, but that's not always the case. we lost contact with primary for 3 days and it was not easy to develop. I made second repository on another server and I cloned local, but I had to do that for a lot of projects and it's time consuming. I prefer to have the second repository automatically updated.