Mirror public GitHub repositories to Codeberg.
github-to-codeberg inventories public repositories for a GitHub user, creates
missing public repositories for a Codeberg user, and pushes GitHub branches and
tags to Codeberg over SSH. It is intentionally one-way: GitHub is the source of
truth, and Codeberg-only work is preserved only as an archive branch before a
fallback force-push.
Install the latest prebuilt binary:
curl -fsSL https://raw.githubusercontent.com/steelbrain/github-to-codeberg/master/scripts/install.sh | bashThe installer verifies the release checksum and installs github-to-codeberg to
~/.local/bin by default. Set GITHUB_TO_CODEBERG_INSTALL_DIR=/path/to/bin to
choose a different directory, or GITHUB_TO_CODEBERG_FORCE=1 to reinstall over
an existing binary.
With Go installed:
go install github.com/steelbrain/github-to-codeberg/cmd/github-to-codeberg@latestCreate a Codeberg personal access token that can create repositories, add an SSH
key to Codeberg, and make sure git can trust codeberg.org.
Preview the sync first:
github-to-codeberg \
--github-user octocat \
--codeberg-user anees \
--codeberg-token "$CODEBERG_TOKEN" \
--ssh-key "$HOME/.ssh/codeberg" \
--dry-runRun the sync:
github-to-codeberg \
--github-user octocat \
--codeberg-user anees \
--codeberg-token "$CODEBERG_TOKEN" \
--ssh-key "$HOME/.ssh/codeberg"The same values can be supplied with GITHUB_USER, CODEBERG_USER,
CODEBERG_TOKEN, and CODEBERG_SSH_KEY.
- Usage covers scope, requirements, sync behavior, environment variables, and fallback archive branches.
- Scheduling shows cron and systemd timer examples.
- Development covers local checks, coverage, release CI, and the code layout.
- Changelog records notable release changes.
MIT. See LICENSE.