Push Mirrors
A push mirror keeps a remote repository in sync with a repository on your Gitea Enterprise instance. Gitea pushes to the remote on an interval and, optionally, on every commit. Starting with Gitea Enterprise v27.3.8, a push mirror can be limited to selected branches, can leave remote branches and tags alone, and keeps a history of its synchronizations.
Add a push mirror
Section titled “Add a push mirror”- Open
Repository > Settings, section Mirror Settings. - Enter the Git remote repository URL and, if the remote needs it, the authorization (username and password or token).
- Choose the Sync interval and optionally Sync when commits are pushed.
- Set the options below and click Add Push Mirror.
Credentials are not written to the git configuration of the repository, and a push mirror never rolls the remote back to an older state.
Options
Section titled “Options”| Option | Description |
|---|---|
| Branches to push | Comma separated branch names or glob patterns, for example main, release/*. Leave empty to push all branches. Remote branches that do not match are left untouched. |
| Do not delete remote branches which do not exist locally | A branch deleted in Gitea stays on the remote. |
| Do not push tags | Tags are not pushed, and remote tags are left untouched. |
| Do not delete remote tags which do not exist locally | A tag deleted in Gitea stays on the remote. |
Use the branch filter and the keep options when the remote is also written by other people or systems, for example a read-only release mirror that carries only main and release/*.
Sync history
Section titled “Sync history”Every synchronization of a push mirror is recorded. Open Sync history next to the mirror to see, for each run:
- the result: Success, Partial (some references failed) or Failed
- the time and duration
- how many references were pushed, deleted and failed, and which references failed with the reason
By default the last 10 runs of each push mirror are kept. Administrators can change this in app.ini:
[mirror]PUSH_HISTORY_KEEP = 10The minimum is 1.
The push mirror API accepts the options in a config object (branch_filters, keep_remote_branches, no_push_tags, keep_remote_tags), and the history is available at:
GET /api/v1/repos/{owner}/{repo}/push_mirrors/{name}/historyAdding, updating and deleting a push mirror are written to the audit log.