[solved] Automated mirroring of Gitea to Gitea

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?

1 Like

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


Thanks. Will look into it.

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:

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.

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

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?

1 Like

The advantage of Warp is language agnosticism. The necessity depends on the language of greatest comfort (e.g. Node or bash wrappers, if desired). If you’re a purist the spf13 tools make the most sense. But there are options.

Any news about this theme?

Is there a way to move the mirroered repo to other organization?

yes, if you go to repo settings for the mirror there is an option to “transfer ownership” of the repo.