github-gitea-mirror
Simple Python Script To Mirror Repository / Gist From Github To Gitea.
✅ Requirements
- Python3 --
sudo apt-get install python3
- PyGithub --
pip install PyGithub
⚙️Installation
Github Clone
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
? Usage
Github Access Token Scopes
- if you want to mirror private repos then select everything under Repo scope
- if you want to mirror public repos then select repo.public_repo scope
- if you want to mirror secret Gists then select gist scope
First make sure you have updated the 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 |
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 |
Run cmd & Wait
$ python3 mirror.py
Cron Setup
- Run
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