Skip to content

Simple script to backup all Github repos for an organisation

License

Notifications You must be signed in to change notification settings

UMCU-Digital-Health/backup-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup GitHub

Ruff GitHub License

This repo provides a script for backing up all git repos from a specified organization or user.

Requirements

  • Python 3.7+
  • Git installed (and configured to access the repositories)

Installation

git clone git@github.com:UMCU-Digital-Health/backup-git.git
cd backup-git
uv sync

Usage

Create a .env file in the project root with the following content:

GITHUB_TOKEN=your_github_token_here
ORGANIZATION=your_organization_or_username_here

Without this token, the script will only be able to access public repositories.

Run the script:

uv run main.py

To schedule this script to run periodically, you can use cron jobs as follows:

crontab -e

And add the following line to run the script daily at 3 AM:

0 3 * * * path/to/venv/bin/python /path/to/your/script/main.py > /path/to/your/logfile.log 2>&1

Get a Fine-grained token on GitHub

To get a fine-grained token on GitHub go to https://github.com/settings/personal-access-tokens and generate a new token that requires read-only access on contents of all repositories.

License

This project is licensed under the MIT License.

About

Simple script to backup all Github repos for an organisation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages