Skip to content

patrickbucher/back-my-git-up

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Back My Git Up

Simple GitHub backup script using Ansible via Suitable.

Prerequisites

  • Create a personal GitHub token with access rights to your repositories.
  • Create an SSH key and add it to your GitHub account.
  • Have Python 3 and the venv module (or some similar mechanism) installed.

Setup

In this repository's folder, run:

$ python3 -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt --upgrade pip setuptools

Create Backup

$ ./backup.py [your GitHub token] backup/
cloning git@github.com:patrickbucher/7l7w.git to backup/7l7w... done in 1.81 seconds
cloning git@github.com:patrickbucher/Arduino.git to backup/Arduino... done in 1.58 seconds
cloning git@github.com:patrickbucher/Raspi.git to backup/Raspi... done in 1.56 seconds
...

The target directory may already exist or, otherwise, will be created. Subsequent backups will update the repositories in the target directory.

I suggest storing the GitHub token in a password manager, such as pass, and export the token as needed:

$ ./backup.py "$(pass show github-token)" backup/

About

Backup of Personal GitHub Repositories

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages