Skip to content

Simplest way to mirror and restore git repositories

License

Notifications You must be signed in to change notification settings

vladpunko/git-deepcopy

Repository files navigation

git-backupper

tests

Simplest way to back up and restore git repositories.

usage-example

Installation

You are to have git installed on your machine.

Use the package manager pip to install git-backupper with the command-line interface:

python3 -m pip install --user git-backupper

Basic usage

Using this program allows you to mirror your git repositories to a backup location.

Warning: Before you begin, it is important to make sure that you have configured git properly and have access to the repositories you want to back up. This will ensure that the backup process goes smoothly and your valuable data is protected.

You are to create a configuration file .git_backupper.json in your home directory with the following content:

{
  "backup_path": "/tmp/backup_repositories",
  "repositories": [
    "https://github.com/vladpunko/git-backupper.git"
  ]
}

This configuration file specifies the directory where backups will be stored, and the git repositories that will be backed up. By default, the backups will be stored in a hidden directory called .backup_repositories in your home directory. You can customize the backup directory path by changing the value of the backup_path field. If you want to include additional repositories in the backup list, just append their urls to the repositories array.

You can back up and restore your repository with the following commands:

# Step -- 1.
git-backupper  # back up all repositories from the configuration file

# Step -- 2.
cd /tmp/backup_repositories/git-backupper.git

# Step -- 3.
git push --mirror https://github.com/vladpunko/git-backupper.git

Contributing

Pull requests are welcome. Please open an issue first to discuss what should be changed.

Please make sure to update tests as appropriate.

# Step -- 1.
python3 -m venv .venv && source ./.venv/bin/activate && pip install pre-commit tox

# Step -- 2.
pre-commit install --config .githooks.yml

# Step -- 3.
tox && tox -e lint

License

MIT

About

Simplest way to mirror and restore git repositories

Topics

Resources

License

Stars

Watchers

Forks

Languages