1

I have a CentOs 7.1 and a Git Server installed on it.

The Git Server is configured with SSH keys so users need a passphrase and a private key to connect to the server.

There are currently 7 repositories, which the users commit to frequently.

The administration of the Git-Server is done by the tool gitolite-admin.

I want to create a backup of the Git Server including every repository and every single configuration setting.

I know that cronjobs can be used for this, but I am not sure wether it is better to clone the repos or zip/tar all git-related folders into a file.

How to do this properly?

2 Answers 2

1

Better is subjective depending on your environment and goals. Using git or tar/gzip will produce a backup.

Use the gitolite writable command to disable pushes to all repos or a specific repo when using tar/gzip or other native backup tool. That will prevent writes to the repository during backup. Your backup will be corrupted if you skip that step and someone writes to the repository during backups.

Run gitolite writable -h for detailed usage. See gitolite documentation for more information http://gitolite.com/gitolite/gitolite.html

1
  • 1
    Please note that you have to run gitolite writable as the gitolite3 user (or whatever it is named on your system).
    – Sven
    Dec 21, 2015 at 14:51
-1

You could use rsync to copy the whole server, tar and store it. My advice would be to store it on an external server (BackBlaze B2 for example).

Here some rsync examples:

Rsync over SSH:

rsync -avzhe ssh [email protected]:/root/install.log /tmp/

If you want to do a dry-run add --dry-run. If you want to replicate the server, deleted files need to be deleted at the target system, add -delete for this.

More rsync examples: http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

1
  • 1
    This ignores the specific problem of guaranteeing a consistent backup of an active repo.
    – Sven
    Dec 21, 2015 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .