Simple Python Script To Mirror Repository / Gist From Github To Gitea
I am a data hoarder.
I am not migrating away from GitHub because I see no reason to: the platform is very useful to me, and I’d not like to lose it. What I’m trying to accomplish is a fail-safe in case something happens to GitHub which would make me lose access, be that voluntarily or involuntarily.
sudo apt-get install python3
pip install PyGithub
Just run the below cmd in your Gitea server
git clone https://github.com/varunsridharan/github-gitea-mirror
Or you can download the source code and install it where ever you need
config.json
Option | Description |
---|---|
github.username |
Your Github Username |
github.accesstoken |
Your Github Account's Personal Access Token |
- | - |
gitea.host |
Selfhosted Gitea URL without / at the end |
gitea.accesstoken |
Your Personal Access Token |
gitea.username |
Account User Name |
gitea.gist.prefix |
Custom Prefix For Repository When Mirroring Gists |
gitea.gist.surfix |
Custom Prefix For Repository When Mirroring Gists |
- | - |
repomap |
Remap A Repository To Diff User |
blacklist |
A list of glob-expression on github full repository names to skip |
gistsSource |
set to true to mirror all Gists Created By You |
gistsStared |
set to true to mirror all Gists Stared By You |
repositoryStared |
set to true to mirror all Repository Stared By You |
repositorySource |
set to true to mirror all Repository Created By You |
repositoryForked |
set to true to mirror all Repository Forked By You |
- | - |
local_cache.enabled |
Set to true to store all repostiory slugs from gitea as json |
local_cache.file_path |
Custom Path to store json file |
Local Cache can come handly when running this script via cron which reduces api request your selfhosted gitea instance
$ python3 mirror.py
crontab -e
mkdir $HOME/mirrorLogs -p
/usr/bin/python3 $HOME/github-to-gitea-mirror/mirror.py > $HOME/mirrorLogs/
date +\%Y-\%m-\%d-\%H-\%M-\%S.log 2>&1
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
If you would like to help, please take a look at the list of issues.
I fell in love with open-source in 2013 and there has been no looking back since! You can read more about me here. If you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.
Built With ♥ By Varun Sridharan 🇮🇳