我和我的同事在GitHub和GitLab上都建立了一个新的存储库。一切都很好,但是由于误解,他将其推送到GitHub,而我将其推送到GitLab。我们在GitLab上设置了rep镜像,但是只有一种方式,这导致我们的存储库出现差异。现在,我想将它们合并,并仅迁移到GitLab,但是当我这样做时:
git remote add gitlab https://username@gitlab.com/username/rep.git
git push --mirror gitlab
我收到以下错误:
remote: GitLab: You are not allowed to force push code to a protected branch on this project
! [remote rejected] branch only on GitLab (pre-receive hook decline)
! [remote rejected] master -> master (pre-receive hook declined)
! [remote rejected] origin/HEAD -> origin/HEAD (deny updating a hidden ref)
! [remote rejected] origin/master -> origin/master (deny updating a hidden ref)
error: failed to push some refs to URL OF THE REP ON GITLAB
虽然我可以尝试将代码复制并粘贴到GitLab上的存储库中,但我想以一种简洁的方式(如果甚至存在这种方式)进行操作。