尝试使用gitlab CI保持两个git repos同步时更新被拒绝错误

时间:2017-04-10 13:46:14

标签: git gitlab gitlab-ci

我正在使用gitlab CI来保持我的代码库在两个不同的gitlab部署中同步。我想只推送一个gitlab部署,然后让CI自动推送到第二个gitlab部署。

为了做到这一点,我在我的.gitlab-ci.yml中添加了登录,但是,在推送到第二个gitlab部署时,我遇到了错误:

$ git pull origin master
From https://gitlab.firstdeployment.com/MYGROUP/myrepo
 * branch            master     -> FETCH_HEAD
Already up-to-date.
$ git pull seconddeployment master
From gitlab.seconddeployment.com:MYGROUP/myrepo.git
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> io/master
Already up-to-date.
$ git status
HEAD detached at 6e8093e
nothing to commit, working directory clean
$ git push io master
To gitlab.seconddeployment.com:MYGROUP/myrepo.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'gitlab.seconddeployment.com:MYGROUP/myrepo.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我知道我可以有力地使用push -f,但是,我不明白为什么当我做正确的{{1}时我从CI中收到此错误的原因}

0 个答案:

没有答案
相关问题