Skip to content
Docs

Documentation

forgemirror is a small Go service. It receives Forgejo push webhooks and mirrors the pushed repository to one or more public forges. Your Forgejo instance can stay private: the only connection it needs is the outgoing webhook to forgemirror.

How it works

    sequenceDiagram
    participant F as Forgejo
    participant M as forgemirror
    participant T as Targets (GitHub, Codeberg, …)
    F->>M: POST /webhook (push event, HMAC-signed)
    M->>M: verify signature, apply filter
    M-->>F: 202 Accepted
    M->>F: git clone --mirror
    par every target
        M->>T: git push --prune (branches + tags)
    end
  
  1. A push to Forgejo sends a signed webhook to forgemirror.
  2. forgemirror verifies the HMAC signature and checks the filter rules. It answers immediately, and mirroring runs in the background.
  3. It clones the repository once into a temporary directory and pushes all branches and tags to every target in parallel. Branches and tags that were deleted on Forgejo are deleted on the targets as well.
  4. Pushes that arrive while a repository is being mirrored are coalesced into exactly one follow-up run. That run mirrors the latest state, so no push is lost and no work is repeated.

Where to go next

Last updated on