Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Mirror git repositories

Project description

Mirror git repositories!

This script is designed to backup a farm of git repositories in an automated fashion, it makes a local mirror that you can push on a remote.

Why?

Because a git repository can disappear, you may loose access to a source code, even if it’s Free/Libre. Large projects with a lot of developers can set up a new repository quickly if the former one is down. How about smaller projects? like this small piece of code you love so much but only a few are interested in?

The same way you backup your holiday pictures, copy your favorite FLOSS, because you have the right to do it! If github screws up, you’ll have your life vest.

Install

What you need

  • git
  • python (tested with python 3.5 but it probably works with former versions)

How to install

With pip

pip install gitbackup

With setup.py

python setup.py install

On archlinux: https://aur.archlinux.org/packages/gitbackup/

Walkthrough

Fetch a local copy

Let’s start with a new sweet home

mkdir backup_github && cd backup_github

Initialize (create a .gitbackup directory that will contain a config file)

gitbackup init

Add repositories (a name of your choice followed by the URL)

gitbackup clone sametmax_0bin https://github.com/sametmax/0bin.git

gitbackup clone carl_backupchecker https://github.com/backupchecker/backupchecker.git

Some time later, let’s synchronize 0bin

gitbackup pull sametmax_0bin

Or all the repositories

gitbackup pull

That’s it! Your local copy is updated. You can write a cron job :)

Push the copy to a remote

We can add a remote for some (or all!) repositories. For example:

gitbackup remote add sametmax_0bin git@git.myserver.org:mirror/bak_sametmax_0bin.git

Once you pulled to sync your copy, you can push

gitbackup push sametmax_0bin

Or, you can push all repositories for which a remote has been configured

gitbackup push

Sync: pull and push

Similarly to the pull and push commands

gitbackup sync sametmax_0bin

Without name, gitbackup will pull all repositories and push those with a remote

gitbackup sync

Other commands

Move a mirror

gitbackup mv sametmax_0bin sametmax_0bin_source

Remove a remote

gitbackup remote rm sametmax_0bin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gitbackup-0.1.2.tar.gz (17.0 kB) Copy SHA256 hash SHA256 Source None Feb 19, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page