Backing up a complete Git server

backupgitgitolite

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?

Best Answer

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