Syncing repository from github to gitee#
I need to sync github repository (files and commits only) https://github.com/copdips/copdips.github.io to gitee repository https://gitee.com/copdips/copdips.github.io.
- In gitee: create an empty repository, normal the same name as the one you want to sync from github. For example for this blog repository: https://gitee.com/copdips/copdips.github.io
- In gitee: create a PAT in gitee with necessary permissions (
all
orprojects
). The sync needs to run two commands against to gitee: git push --all --force gitee
git push --tags --force gitee
- In github repository: create 2 secrets:
GITEE_USERNAME=copdips
, andGITEE_PAT={PAT_created_in_the_previous_step}
- In github repository: create a github workflow, such as: .github/workflows/sync-to-gitee.yml
- In github repository: push the above github workflow file to github, it will automatically trigger the first sync. And from now on, all the pushes to the
main
branch will trigger a such sync too.main
is my default branch to trigger the sync, could be changed in the workflow file.
Note
Github action within github free personal plan has a time limit at 2000 minutes per month, which should be enough if you don't have many repositories and many pushes.