1.在gitee、github、coding创建相同名字项目
1
| 比如: 账号名: hihahoo 仓库名: hihahoo.github.io
|
2.关联远程仓库
1 2 3 4
| git init git remote add gitee https://gitee.com/hihahoo/hihahoo.github.io git remote add github https://github.com/hihahoo/hihahoo.github.io git remote add coding https://coding.com/hihahoo/hihahoo.github.io
|
3.拉取github仓库代码至本地。同步代码至其他仓库
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| git pull github master From https://github.com/d551599736/d551599736.github.io * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories #报错 git pull github master --allow-unrelated-histories git push gitee master git push coding master hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. git push -f coding master
|
由于初始化项目,使用强制推送不会对项目造成影响,三个仓库数据代码保持一致!!!