Mirror from GitLab and Gitea/Forgejo: source provider dropdown in the configuration card #151

Closed
opened 2026-10-05 01:44:59 +02:00 by adam · 0 comments
Owner

Why

People want to back up repos from hosts other than GitHub. #371 asks for GitLab, Codeberg and self hosted Forgejo or Gitea. #221 asks for more than one connection. #131 and the feature/matrix branch from #368 go further with a full source and target matrix. The source side can ship on main now in a smaller form, and the matrix work can build on it.

What this step adds

  • A Source dropdown at the top of the GitHub configuration card with three options: GitHub, GitLab, Gitea/Forgejo. Codeberg runs Forgejo, so it is covered by the third option.
  • Picking GitLab or Gitea/Forgejo shows an instance URL field. Defaults are gitlab.com and codeberg.org. Username and token stay as they are.
  • A source provider interface behind the config. It covers: list the user's repos, list org or group repos, list starred repos, check that a repo still exists, and build clone credentials. GitHub keeps the current Octokit code as its adapter. GitLab and Gitea/Forgejo get adapters based on the importer already written in #368.
  • Scheduler auto import and deleted repo cleanup go through the interface instead of calling GitHub directly.
  • Each repository row records its source provider and host. The mirror step picks credentials per repo from that. This also makes the later multi source step a column and a list in the UI rather than another rewrite.
  • One source per user in this step.

Works for GitLab and Gitea/Forgejo from day one

Code mirroring with branches and tags through the Gitea pull mirror, scheduled sync, LFS, auto import of new repos, cleanup of deleted repos, starred repos, and wiki where the host exposes a .wiki.git remote. Both migrate calls already tell Gitea the source is plain git with a clone URL and credentials, so the transport does not change. Only the auth username differs per host.

GitHub only for now

Issue, pull request, release and milestone mirroring, starred lists, and force push detection. These run on the GitHub API. The card hides those switches when the source is not GitHub and says why.

Not in this step

  • Several sources at once. That is the follow up: the card grows into a list of sources and repos get a source id.
  • Targets other than Gitea. That is feature/matrix.
  • Bidirectional mirroring. Not planned, ever. Gitea Mirror is a backup tool.
  • Gitflic and other hosts without a usable API.

Verification

Unit tests with the fetch mock for both adapters. Discovery against the public gitlab.com and codeberg.org APIs, which need no token. An end to end mirror from Codeberg into a local Gitea. Private repo and self hosted GitLab runs need real tokens.

## Why People want to back up repos from hosts other than GitHub. #371 asks for GitLab, Codeberg and self hosted Forgejo or Gitea. #221 asks for more than one connection. #131 and the `feature/matrix` branch from #368 go further with a full source and target matrix. The source side can ship on main now in a smaller form, and the matrix work can build on it. ## What this step adds - A **Source** dropdown at the top of the GitHub configuration card with three options: GitHub, GitLab, Gitea/Forgejo. Codeberg runs Forgejo, so it is covered by the third option. - Picking GitLab or Gitea/Forgejo shows an instance URL field. Defaults are gitlab.com and codeberg.org. Username and token stay as they are. - A source provider interface behind the config. It covers: list the user's repos, list org or group repos, list starred repos, check that a repo still exists, and build clone credentials. GitHub keeps the current Octokit code as its adapter. GitLab and Gitea/Forgejo get adapters based on the importer already written in #368. - Scheduler auto import and deleted repo cleanup go through the interface instead of calling GitHub directly. - Each repository row records its source provider and host. The mirror step picks credentials per repo from that. This also makes the later multi source step a column and a list in the UI rather than another rewrite. - One source per user in this step. ## Works for GitLab and Gitea/Forgejo from day one Code mirroring with branches and tags through the Gitea pull mirror, scheduled sync, LFS, auto import of new repos, cleanup of deleted repos, starred repos, and wiki where the host exposes a `.wiki.git` remote. Both migrate calls already tell Gitea the source is plain git with a clone URL and credentials, so the transport does not change. Only the auth username differs per host. ## GitHub only for now Issue, pull request, release and milestone mirroring, starred lists, and force push detection. These run on the GitHub API. The card hides those switches when the source is not GitHub and says why. ## Not in this step - Several sources at once. That is the follow up: the card grows into a list of sources and repos get a source id. - Targets other than Gitea. That is `feature/matrix`. - Bidirectional mirroring. Not planned, ever. Gitea Mirror is a backup tool. - Gitflic and other hosts without a usable API. ## Verification Unit tests with the fetch mock for both adapters. Discovery against the public gitlab.com and codeberg.org APIs, which need no token. An end to end mirror from Codeberg into a local Gitea. Private repo and self hosted GitLab runs need real tokens. <!-- github-sync-id:5320804574 -->
adam closed this issue 2026-10-05 01:44:59 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/gitea-mirror#151