将git代码同步到多个源 发表于 2023-03-04 更新于 2023-08-23 应用场景,将github的开源代码同步到国内gitee源,需要同步所有分支以及提交。使用git mirror方案。 将github项目更新到本地命令如下,一定要加上–mirror参数 1git clone --mirror https://github.com/xxx.git 更新并推送到giteepush 时一定要带上–mirror 12git fetch -p origin #更新到最新git push --mirror https://gitee.com/xxx.git 这个脚本加入到定时脚本,后续就能定时同步代码了。