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
funworkerpipeline (--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
- Look up the latest commit sha of the source default branch on GitHub.
- If the repo doesn't exist yet on Gitee, create it; otherwise look up the latest commit sha of the same branch on Gitee.
- If both shas match, skip — nothing to do.
- Otherwise
git clonefrom GitHub, thengit 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.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| funmirror-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / funmirror-0.1.4-py3-none-any.whl
| Download URL | funmirror-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae4c340f697b44966b1bf7924763179d5b6733d8b3b058494cac9aea59e769fb
|
|
BLAKE2b-256 checksum How to use checksums |
f00b7c97d12c8d904ad829f0547c6197de69624f7b55164d05349c92e9af1840
|
| 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}
|