I have found that I can fully backup a git repo, backup a bare repo and much more.

What I am interested in, though, is, how to backup the whole git server with all repos - daily, onto a server in a datacenter. E.g. should new repos be added, they should automatically be backuped as well.

Because of NAT and dynamic IP addresses, the datacenter server cannot access the local server, so the backup would have to be initiated by our git server.

Before I now go for a bash script iterating over all repos, I'd like to know whether there is a solution built into git!?

  • 1
    Git is not aware of other repositories on the same server, unless you are using some more complex git tools or server. – Florin Asăvoaie Jan 14 '16 at 10:34
  • Why not using rsync or something similar and just copy the folder containing all the repos? – gf_ Jan 14 '16 at 10:37
  • rsync is not safe and can turn into corrupt and stale repo's at the backup site. You could write a script that clones the git repo to a SSHFS on the remote server with the --mirror option. – Exsisto Jan 14 '16 at 10:41
  • I could imagine to do: Stop the git server for a short time, make a checksum of the dir, rsync this dir to somewhere else, make a new checksum of the rsynced-to-dir and compare both checksums. – gf_ Jan 14 '16 at 11:21

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.