{"id":21877099,"url":"https://github.com/x-actions/git-mirrors","last_synced_at":"2025-08-25T21:11:51.700Z","repository":{"id":38470431,"uuid":"496077472","full_name":"x-actions/git-mirrors","owner":"x-actions","description":"Git 仓库同步 by Github Action / mirror git repos(support github/gitee)","archived":false,"fork":false,"pushed_at":"2023-07-30T11:34:02.000Z","size":3389,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-23T07:34:11.646Z","etag":null,"topics":["action","gitee","github","golang","mirror"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-25T04:08:12.000Z","updated_at":"2023-04-02T12:15:49.000Z","dependencies_parsed_at":"2024-06-19T11:15:17.042Z","dependency_job_id":"ebdc9fe4-7082-41be-b4d7-798d689b20c7","html_url":"https://github.com/x-actions/git-mirrors","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/x-actions/git-mirrors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-actions%2Fgit-mirrors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-actions%2Fgit-mirrors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-actions%2Fgit-mirrors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-actions%2Fgit-mirrors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-actions","download_url":"https://codeload.github.com/x-actions/git-mirrors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-actions%2Fgit-mirrors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272131876,"owners_count":24879005,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","gitee","github","golang","mirror"],"created_at":"2024-11-28T08:08:06.926Z","updated_at":"2025-08-25T21:11:51.670Z","avatar_url":"https://github.com/x-actions.png","language":"Go","readme":"# git-mirrors\n\n[![build-test](https://github.com/x-actions/git-mirrors/actions/workflows/workflow.yaml/badge.svg)](https://github.com/x-actions/git-mirrors/actions/workflows/workflow.yaml)\n[![GoDoc](https://godoc.org/github.com/x-actions/git-mirrors?status.svg)](https://pkg.go.dev/github.com/x-actions/git-mirrors)\n[![Go Report Card](https://goreportcard.com/badge/github.com/x-actions/git-mirrors)](https://goreportcard.com/report/github.com/x-actions/git-mirrors)\n\na tools Mirrors Code from Github to Gitee.\n\n## Feature\n\n- Support Private/Public Organization/User 's Repos sync\n- Support The Sample Git Provides sync, like `github.com/xiexianbin/test` to `github.com/x-actions/test`\n\n## Parameters\n\n兼容 `Yikun/hub-mirror-action`\n\n### Must\n\n- `src` `github/\u003cname\u003e` name 可以是 user name 或 org name, eg: `github/xiexianbin`\n- `src_token` :smile: `扩展参数`，源的 API tokens，支持 [Gitee](https://gitee.com/profile/personal_access_tokens)、[Github](https://github.com/settings/tokens)\n  - 若配置为 `${{ secrets.GITHUB_TOKEN }}`，仅支持同步公开仓库，Github Action 会中自动注入 token\n  - 若需要同步私有仓库，需配置 ${{ secrets.PERSONAL_ACCESS_TOKEN }}，`PERSONAL_ACCESS_TOKEN` 在这里[创建](https://github.com/settings/tokens)\n- `dst` `gitee/\u003cname\u003e` name 可以是 user name 或 org name, eg: `gitee/xiexianbin`\n- `dst_key` 目的端和源端的 ssh public key\n- `dst_token` 创建仓库的API tokens，支持[Gitee](https://gitee.com/profile/personal_access_tokens)、[Github](https://github.com/settings/tokens)\n\n### Optional\n\n- `account_type` org(Organization) or user, default is user\n- `src_account_type` 默认为account_type，源账户类型，可以设置为org（组织）或者user（用户）。\n- `dst_account_type` 默认为account_type，目的账户类型，可以设置为org（组织）或者user（用户）。\n- `clone_style` just support ssh, and `dst_key` must configure both github and gitee\n- `cache_path` 默认为''，将代码缓存在指定目录，用于与 [actions/cache](https://github.com/actions/cache)配合以加速镜像过程。\n- `black_list` 默认为''，配置后，黑名单中的repos将不会被同步，如“repo1,repo2,repo3”。\n- `white_list` 默认为''，配置后，仅同步白名单中的repos，如“repo1,repo2,repo3”。\n- `force_update` 默认为`false`, 配置后，启用`git push -f`强制同步，**注意：开启后，会强制覆盖目的端仓库**。\n- `debug` 默认为`false`, 配置后，启用debug开关，会显示所有执行命令。\n- `timeout` 默认为'30m', 用于设置每个git命令的超时时间，'600'=\u003e600s, '30m'=\u003e30 mins, '1h'=\u003e1 hours\n- `mappings` 源仓库映射规则，比如'A=\u003eB, C=\u003eCC', A会被映射为B，C会映射为CC，映射不具有传递性。主要用于源和目的仓库名不同的镜像。\n- `ssh_keyscans` :smile: `扩展参数`，默认为 `github.com,gitee.com`\n\n## How to Use\n\n- Github Action\n\nSample Use\n\n```\n      - name: git mirror\n        uses: x-actions/git-mirrors@main\n        with:\n          src: github/${{ matrix.github }}\n          src_token: ${{ secrets.GITHUB_TOKEN | secrets.PERSONAL_ACCESS_TOKEN }}\n          dst: gitee/${{ matrix.gitee }}\n          dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}\n          dst_token: ${{ secrets.GITEE_TOKEN }}\n          account_type: user\n          cache_path: \"/github/workspace/git-mirrors-cache\"\n          black_list: \"openbilibili,test1\"\n          clone_style: ssh\n```\n\nall Params\n\n```\n      - name: git mirror\n        uses: x-actions/git-mirrors@main\n        with:\n          src: github/${{ matrix.github }}\n          src_token: ${{ secrets.GITHUB_TOKEN }}\n          dst: gitee/${{ matrix.gitee }}\n          dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}\n          dst_token: ${{ secrets.GITEE_TOKEN }}\n          account_type: user\n          # src_account_type: org\n          # dst_account_type: org\n          cache_path: \"/github/workspace/git-mirrors-cache\"\n          black_list: \"openbilibili,test1\"\n          white_list: \"w1,w2\"\n          clone_style: ssh\n          force_update: false\n          debug: true\n          timeout: 30m\n          mappings: \"A=\u003eB, C=\u003eCC\"\n```\n\n- command line\n\n```\n# download\ncurl -Lfs -o git-mirrors https://github.com/x-actions/git-mirrors/releases/latest/download/git-mirrors-{linux|darwin|windows}\nchmod +x git-mirrors\n\n# help\n./git-mirrors -h\n\n# demo\ngit-mirrors \\\n  --src \"github/estack\" \\\n  --src-token \"${GITHUB_TOKEN}\" \\\n  --dst \"gitee/e-stack\" \\\n  --dst-key \"\" \\\n  --dst-token \"${GITEE_TOKEN}\" \\\n  --account-type \"user\" \\\n  --clone-style \"ssh\" \\\n  --cache-path \"./temp/\" \\\n  --black-list \"\" \\\n  --white-list \"\" \\\n  --force-update=true \\\n  --debug=true \\\n  --timeout \"10m\"\n```\n\n## FaQ\n\n- ssh key err\n\n```\nclone git@github.com:xx/xx.git err: unknown error: ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.\n```\n\nregenerate ssh key:\n\n```\n$ ssh-keygen -t ed25519 -C \"your_email@example.com\"\n\n# or\n$ ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"\n```\n\nmore info go to https://github.blog/2021-09-01-improving-git-protocol-security-github/\n\n- git ssh\n\n```\n[git clone git@github.com:xxx/xxx.git] in path /github/workspace/git-mirrors-cache/xxx/xxx\n[ERROR] [1/29] (1/36) mirror occur err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain\n```\n\n`dst_key` must configure both `github` and `gitee`\n\n## Ref\n\n- 采用兼容 [Yikun/hub-mirror-action](https://github.com/Yikun/hub-mirror-action) 的配置参数，因此不可避免的参考其实现，在此表示感谢。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-actions%2Fgit-mirrors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-actions%2Fgit-mirrors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-actions%2Fgit-mirrors/lists"}