Automated mirroring of Gitea to Gitea


#1

There are github issues about mirroring from github and gitlab etc into gitea, but I’ve not yet seen anyone talk about automated mirroring of one gitea instance to another.

My personal use case is mirroring my main remote gitea instance repos to repos running on my home server. So far I’ve been setting up a mirror on the my home server manually for each new repo I create on the remote. But that’s tedious…and I’ve gotten a bit behind.

It looks like most of the required features already exist in the gitea API. Has anyone done this via script or whatever?


Update mirror cron job on admin/monitor page...how's that done?
#2

Yup, automated mirror is possible. I have a script that does a one-off mirror from GitHub to Gitea, but could be updated to do Gitea->Gitea, and maybe if you run it on a cron then it will pick up new repos that haven’t been mirrored yet.

My script is here: https://gist.github.com/techknowlogick/c2367e03baff9f16b3c5cc9d9a5d13ca


#3

Thanks. Will look into it.


#4

Curious if you were able to land this feature if you’ve come around to it, @adrinux. Looking forward to v2 of your hugo starter. :smiley_cat:


#5

I forked techknowlogick’s gist into a repo, but haven’t had chance to look at it properly. https://github.com/adrinux/gitea-mirror-gitea

Would be nice to add config files and command line flags.


#6

Might be able to cajole that into warp and write the cli in bash to make it more portable.


#7

Since it’s already written in go I’d assumed using Cobra (for cli) and Viper (for config files) would be doable. May be beyond my current talents/time availability though. Warp seems unnecessary?