Friday, April 20, 2018

Keeping git repositories on different hosts in sync

Source: https://softwareengineering.stackexchange.com/questions/195456/keeping-git-repositories-on-different-hosts-in-sync

Yes, that's exactly the beauty of DVCS such as git. You can use any number of different repos with the same state as the one on bitbucket or github.
Even you local copy (the repository on your computer) is usually a full clone of the remote repo.
The only thing you have to do to keep multiple repos in sync is pulling for one (usually called origin or upstream) and pushing to the backup copies.
 
 Unfortunately all is not as shiny. See the cautionary take of KDE near-disaster. That is, make sure the backup does not delete things (branches, repositories, etc.) that were deleted on the backed up server. 

Clone the remote repository, then pull all updates (all branches) to it in regular intervals. A git clone contains the history, it's not like an svn checkout that has only the latest version.

1 comment:

  1. Thanks you for giving this info. I really needed this. Good work
    From Team Subway Street Run
    Thanks

    ReplyDelete