Yikun/hub-mirror-action
Yikun/hub-mirror-action has 711 GitHub stars and 197 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 19:23 UTC. Last push 2026-05-07.
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
一个Github Action,用于在Github, Gitee, GitLab和GitCode之间同步代码。Action for mirroring repos between Hubs (like Github, Gitee, GitLab and GitCode).
Developer ToolsREADME_en.md
OriginalHub Mirror Action
English | 简体中文
Action for mirroring repos between Hubs (like GitHub, Gitee, GitLab and GitCode).
Tutorial
steps:
- name: Mirror the Github organization repos to Gitee.
uses: Yikun/hub-mirror-action@master
with:
# Support gitee, github, gitlab and gitcode
src: github/kunpengcompute
# Support gitee, github, gitlab and gitcode
dst: gitee/kunpengcompute
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
# If source requires authentication (e.g., organization or private repos), configure src_token
# src_token: ${{ secrets.GITHUB_TOKEN }}
# Support github/gitee/gitcode user, org and gitlab group
account_type: org
# Supporte set account type speparately
# src_account_type: org
# dst_account_type: org
Here is a workflow to mirror the kunpengcompute org repos from Github to Gitee, see more complete workflows in here.
Please refer to scenarios for more examples.
Who are using?
More than 100+ organizations,4000+ users are using, 50+ related blogs from users:
Usage
Required
srcsource account, such asgithub/kunpengcompute, is the Github kunpengcompute account.dstDestination account, such as/kunpengcompute, is the Gitee kunpengcompute account.dst_keythe private key to push code in destination account (default in ~/.ssh/id_rsa), you can see generating SSH keys to generate the pri/pub key, and make sure the pub key has been added in destination. You can set Github ssh key in here,set the Gitee ssh key in here, set the Gitlab ssh key in here, set the Gitcode ssh key in here.dst_tokenthe API token to create non-existent repo, You can get Github token in here, and the Gitee in here. and for GitLab in here ,and for GitCode in here (Required scopes: api, read_api, read_repository, write_repository).
Optional
src_token(optional) the API token used to fetch the repository list from the source hub. Required if the source is a private organization or has API rate limits (e.g., GitCode, Gitee). You can get Github token in here, and the Gitee in here. and for GitLab in here, and for GitCode in here.account_type(optional) default isuser, the account type of src and dst account, can be set toorgoruser,For GitLab: can be set togrouporuser,only support mirror between same account type (that is "org to org" or "user to user" or "group to group"). if u wanna mirror difference account type, use thesrc_account_typeanddst_account_typeplease.src_account_type(optional) default isaccount_type, the account type of src account, can be set toorgoruserorgroup.dst_account_type(optional) default isaccount_type, the account type of dst account, can be set toorgoruserrgroup.src_endpoint(optional) only for self-hosted GitLab source, used for self-hosted GitLab endpoint likegitlab.example.com(no https:// prefix), default is empty.dst_endpoint(optional) only for self-hosted GitLab destination, used for self-hosted GitLab endpoint likegitlab.example.com(no https:// prefix), default isgitlab.com.clone_style(optional) default ishttps, can be set tosshorhttps.When you are using ssh clone style, you need to configure the public key ofdst_keyto both source end and destination end.cache_path(optional) defaults tohub-mirror-cache, let code clone in specific path, can be used with actions/cache to speed up mirror. If it is a relative path, it will be prefixed with${{ github.workspace }}.black_list(optional) the black list, such as “repo1,repo2,repo3”.white_list(optional) the white list, such as “repo1,repo2,repo3”.static_list(optional) Only mirror repos in the static list, but don't get list from repo api dynamically (the white/black list is still available). like 'repo1,repo2,repo3'force_update(optional) Force to update the destination repo, use '-f' flag do 'git push'timeout(optional) Default is '30m', set the timeout for every git command, like '600'=>600s, '30m'=>30 mins, '1h'=>1 hoursmappings(optional) Default is empty, the source repos mappings, such as 'A=>B, C=>CC', source repo name would be mapped follow the rule: A to B, C to CC. Mapping is not transitive.lfs(optional) Default is false, support git lfs, callgit lfs fetch --allandgit lfs push --allto support lfs mirror.api_timeout(optional) Default is60, sets the timeout for API requests (in seconds). Example usage:api_timeout: '90'
Scenarios
Organization mirror, mirror the Github/kunpengcompute to Gitee/kunpengcompute
- name: Organization mirror
uses: Yikun/hub-mirror-action@master
with:
src: github/kunpengcompute
dst: gitee/kunpengcompute
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
account_type: org
GitLab group mirror, mirror from GitHub organization to GitLab group
- name: GitLab group mirror
uses: Yikun/hub-mirror-action@master
with:
src: github/organization-name
dst: gitlab/group-name
# Optional for self-hosted GitLab
# dst_endpoint: gitlab.example.com
dst_key: ${{ secrets.GITLAB_PRIVATE_KEY }}
dst_token: ${{ secrets.GITLAB_TOKEN }}
account_type: group
src_account_type: org
dst_account_type: group
White/Black list, only mirror the Yikun/hub-mirror-action but not Yikun/hashes
- name: Single repo mirror
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
white_list: "hub-mirror-action"
white_list: "hashes"
Static list, only mirror the repos hub-mirror-action and hashes
- name: Black list
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "hub-mirror-action,hashes"
clone style, use ssh clone style
Note: please configure the public key of dst_key to the source (github in here) and destination(gitee in here)
- name: ssh clone style
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
clone_style: "ssh"
set sepecific cache
Note: see also the real example in .github/workflows/verify-on-ubuntu-user-cache.yml
- name: Mirror with specific cache
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
cache_path: hub-mirror-cache
Force udpate and enable the debug flag
- name: Mirror with force push (git push -f)
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
force_update: true
debug: true
Set command timeout to an hour
- name: Mirror with force push (git push -f)
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
force_update: true
timeout: '1h'
Sync between different repo name(github/yikun/yikun.github.com to gitee/yikunkero/blog)
- name: mirror with mappings
uses: Yikun/hub-mirror-action@mappings
with:
src: github/yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
mappings: "yikun.github.com=>blog"
static_list: "yikun.github.com"
Only sync repository list exclude private and fork
- name: Get repository list exclude private and fork
id: repo
uses: yi-Xu-0100/[email protected]
- name: Mirror repository list exclude private and fork
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: ${{ steps.repo.outputs.repoList }}
Support LFS mirror
- name: Mirror with lfs (git lfs fetch/push --all)
uses: Yikun/hub-mirror-action@master
with:
src: github/Yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
lfs: true
FAQ
How to use
secretsto add token and key?You can use below steps to add secrets, you can also see more in Secrets.
- Get Token and Key:
- Github: Configure and save your ssh key and token
- Gitee: Configure and save your ssh key and token
- Gitlab: Configure and save your ssh key and token
- Gitcode: Configure and save your ssh key andtoken
- Add Secrets,add settings-secrets in repo,like
GITEE_PRIVATE_KEY、GITEE_TOKENorGITLAB_PRIVATE_KEY、GITLAB_TOKENorGITCODE_PRIVATE_KEY、GITCODE_TOKEN - Add workflow,add the workflow file into .github/workflows.
Reference
- Hub mirror template: A template repo to show how to use this action. from @yi-Xu-0100
- Auto-Sync GitHub Repositories to Gitee: An introduction about how to use this action. from @ShixiangWang
- Use Github Action to sync reois to Gitee: The blog for this action.
Platform-Specific Notes
GitLab
- Uses
groupinstead oforgfor organizational accounts - Only top-level groups are supported for mirroring. Nested subgroups (group/subgroup) are not supported yet
- Requires API token with appropriate scopes (api, read_api, read_repository, write_repository)
- When mirroring to GitLab, ensure your group/user has sufficient permissions to create repositories
- GitLab.com has API rate limits of 2000 requests per minute for authenticated users
- GitLab API Documentation: Official GitLab API documentation
- GitLab Personal Access Tokens: Guide for creating GitLab tokens














