How to maintain a repository mirror with a small code change

How to maintain a repository mirror with a small code change?

Things I’ve tried:

  • to create my modified branch in the mirror, but mirrors do not let users create their own branches.

  • create a third repository, that the mirror would push to. However, any protected branch in this repository breaks pushes from the mirror. In addition, unprotected branches are wiped-out whenever the mirror pushes to this repository.

  • Using cron or something similar is not ideal

  • Manually updating the repository is not ideal as well

I’d appreciate some ideas, or if Gitea could use this topic as a way to improve how mirrors work.
If we could create protected branches in the mirror itself, or in the repositories the mirrors pushes to, then it would work as a charm.

You are describing a fork rather than a mirror. A mirror is identical to the source. A fork can have changes. You may be able to automate updating your fork to keep it on sync with upstream, but I have never attempted that, so I have no advice to offer on how to accomplish that.

You can use Gitea Actions’ cron job to do that which is more flexible than internal mirror feature.

1 Like