Git强制推送失败

时间:2019-05-13 09:52:20

标签: git git-push scmmanager

我正尝试硬重置master分支,因此它反映了我们“ develop”分支的当前状态。

我们不关心master上的任何旧提交,并希望重写其历史记录。 我应该注意,我们使用的是自托管的Git服务器,名为“ SCM-Manager ”(没有GitHub或类似服务)。我在存储库中确实拥有“所有者”特权。

我正在使用以下命令将Develop的状态强制推为Master:

git push origin +develop:master --no-verify --force

但我不断收到此错误消息:

! [rejected]            develop -> master (non-fast-forward)
error: failed to push some refs to 'https://****.git'
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.

我们非常感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

我通过在SCM-Manager控制台中删除“ master”分支作为默认分支来解决了该问题。

enter image description here

这使我可以删除该分支,然后将其重新创建为“ develop”分支的副本。

答案 1 :(得分:-1)

如错误消息所示:尝试进行git push之前,先进行git pull。显然您的本地分支与跟踪分支不同步。

相关问题