gpt4 book ai didi

Git push 无法推送到原点 - 没有这样的引用

转载 作者:太空狗 更新时间:2023-10-29 13:23:31 25 4
gpt4 key购买 nike

我无法将使用 git-flow 创建的 hotfix 分支上的提交推送到远程存储库。

这里是错误:

$ 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}

我用标准语法创建了 hotfix:

git flow hotfix start MyHotfix

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

有没有人在使用 gitgit-flow 之前遇到过这个问题并找到了解决方案?

注意 - 我尝试过的事情:

  • 重新克隆远程仓库 -> 同样的错误
  • 正在删除本地分支 -> 同样的错误
  • 删除远程分支 -> 我可以推送"new"分支,但是当他尝试推送提交时(在 git remote prune origin 之后),我的同事在本地存储库中遇到了同样的错误
  • 强制推送 -> 同样的错误
  • 上游推送 -> 同样的错误
  • 正在检查 refs -> 我的提交父 ID 与服务器匹配

更新:

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

最佳答案

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

git fsck --full
git prune
git gc

注意:根据手册页,git prune 不是必需的,因为 git gc 会调用它,但我尝试了所有方法。

关于Git push 无法推送到原点 - 没有这样的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14756796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com