Git push无法推动原点 - 没有这样的参考

Lau*_*nce 5 git hotfix git-flow

我在使用远程存储库hotfix创建的分支上推送提交时遇到了问题git-flow.

这是错误:

$ git push origin hotfix/MyHotfix
Counting objects:
... etc
To {my remote repo}
 ! [remote rejected] hotfix/MyHotfix -> hotfix/MyHotfix (no such ref)
error: failed to push some refs to {my remote repo}
Run Code Online (Sandbox Code Playgroud)

hotfix用标准语法创建了:

git flow hotfix start MyHotfix
Run Code Online (Sandbox Code Playgroud)

这个分支已经存在origin,我可以看到git branch -a.我还检查了分支仍然存在于远程服务器上,因为它在我运行时出现git remote show origin.

有没有人遇到过这个git或者git-flow找到了解决方案?

注意 - 我尝试过的事情:

  • 重新克隆远程仓库 - >同样的错误
  • 删除本地分支 - >相同的错误
  • 删除远程分支 - >我可以推送'new'分支,但是当他试图推送提交时(后git remote prune origin),我的同事本地仓库会收到相同的错误
  • 强制推动 - >同样的错误
  • 上游推送 - >同样的错误
  • 检查引用 - >我的提交父ID与服务器匹配

更新:

git ls-remote origingit show-ref显示本地和远程修补程序分支的不同引用,但这是因为我在本地有1个额外提交,并且父提交的引用与引用匹配origin.

Lau*_*nce 3

看起来这实际上是服务器存储库的问题。在服务器上的裸存储库上运行这些步骤可以清除错误:

git fsck --full
git prune
git gc
Run Code Online (Sandbox Code Playgroud)

注意:根据手册页,git prune不需要,因为git gc调用它,但我正在尝试一切。