MENU

git同步多个远端仓库

July 7, 2020 • 默认分类

问题

已经存在仓库1,新建一个仓库2,需要将仓库2与仓库1同步

git add .
git commit "sync"
git push -u origin master -f
! [remote rejected] master -> master (shallow update not allowed)

解决

git fetch --unshallow [repo2]
git push -u origin master -f

git 本地dev分支强行覆盖远端主分支

git checkout develop
git pull
git push origin develop:master -f
git checkout master
git fetch --all
git reset --hard origin/master

git 远端强行覆盖本地

Last Modified: July 31, 2021