This script uses Gitea's API to manage remote push mirrors for local repositories.
I recently installed Gitea and like to keep my dotfiles and some other projects synced between local, GitHub and GitLab.
After realizing that GitHub and GitLab's API Keys expire and I would have to update every mirror on a regular basis, someone mentioned that automating this may be a good idea.
Herein lies my attempt.
The script uses Python's builtin modules so no external dependencies are required.
I organize my repositories in Organizations (Gitea, GitHub) and Groups (GitLab) and this script manages the mirrors using that layout.
Create API keys in Gitea, GitHub and GitLab - or wherever you want to push to.
Copy settings.json.example to settings.json and edit it accordingly.
Add any repositories you do not want to sync to the gitea_ignore_sync section.
It may or may not work without Organization/Group repository structure.
It doesn't check if a mirror exists - It will delete any existing push mirrors and re-create them.
It doesn't check if the remote repository exists - It will create the remote mirrors but GitHub will have errors in the Web UI and GitLab will create a private repository if it does not exist.
It doesn't verify your API keys for GitHub or GitLab.
It doesn't check ignore repository group/orginazation. Currently, it just uses the repository name to ignore.
It doesn't handle Exceptions like it probably should.
These features may or may not be added in the future - time permitting.
Any pull requests improving the code and/or performance are welcomed.
Exactly what I needed it to -- update GitHub/GitLab API keys on my Gitea push mirrors :)