Skip to main content

funmirror

Mirror every repo in a GitHub organization to a Gitee organization, in parallel, skipping repos whose default branch hasn't changed since the last run.

Built for farfarfun-action/mirror-to-gitee, which is a thin wrapper around this package's CLI. It reproduces the core behavior of Yikun/hub-mirror-action (clone from GitHub, force-push refs/remotes/origin/*:refs/heads/* plus tags to Gitee) without depending on that action, and adds two things it doesn't have:

  • Parallelism — repos are mirrored concurrently via a funworker pipeline (--workers, default 8).
  • Skip-if-unchanged — before cloning anything, the latest commit sha of the source and destination default branch is compared; if they already match, the repo is skipped entirely.

Install

pip install "git+https://github.com/farfarfun/funmirror.git@v0.1.0"

Usage

funmirror mirror \
  --github-org my-org \
  --gitee-org my-org \
  --gitee-token "$GITEE_TOKEN" \
  --gitee-key-file ~/.ssh/gitee_deploy_key \
  --github-token "$GITHUB_TOKEN" \
  --repo-names repo-a,repo-b \
  --workers 8

--repo-names is optional; if omitted, every repo in --github-org is mirrored (requires --github-token to list them).

Exit code is 1 if any repo failed to mirror; a one-line summary (Mirrored X, skipped Y, failed Z (total N)) is printed and, if GITHUB_STEP_SUMMARY is set, appended to it.

How a single repo is mirrored

  1. Look up the latest commit sha of the source default branch on GitHub.
  2. If the repo doesn't exist yet on Gitee, create it; otherwise look up the latest commit sha of the same branch on Gitee.
  3. If both shas match, skip — nothing to do.
  4. Otherwise git clone from GitHub, then git push (force by default) refs/remotes/origin/*:refs/heads/* plus tags to Gitee over SSH, with retries.

Development

pip install -e ".[dev]"
pytest

Metadata

Release files for funmirror 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for funmirror 0.1.3
File Interpreter ABI Platform
funmirror-0.1.3-py3-none-any.whl Python 3 none any Details

Release files / funmirror-0.1.3-py3-none-any.whl

Download URL funmirror-0.1.3-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d09d6f8ef08ffc2372a9a6054788e1ed77cd2164be9557ec8d0d064eadd76903
BLAKE2b-256 checksum
How to use checksums
c0b0f539063171f8b4dfa3f77d5ee6fc0477f868c2da2c345139675ea1027ee8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.1.4

1 release file

This release

0.1.3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page