Git pull 失败:无法更新本地引用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11984783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git pull fails : unable to update local ref
提问by Stanislav O Chernykh
I'm totally messed with my git repository. I can't push / pull remote branch..it disappeared from git extensions...
我完全搞砸了我的 git 存储库。我不能推/拉远程分支......它从 git 扩展中消失了......
I use Git Extensions 2.33 , msysgit Git-1.7.11-preview20120710.exe
我使用 Git 扩展 2.33 , msysgit Git-1.7.11-preview20120710.exe
C:\Program Files (x86)\Git\bin\git.exe pull --progress "biometric" +refs/heads/try_merge:refs/remotes/biometric/try_merge
error: unable to resolve reference refs/remotes/biometric/try_merge: No such file or directory
From biometric.bmstu.ru:test
! [new branch] try_merge -> biometric/try_merge (unable to update local ref)
Done
$git fsck output
error: bad ref for refs/remotes/biometric/try_merge
When i try to push something to remote git thinks that it is a brand new branch for remote repository. How can I recover it?
当我尝试将某些内容推送到远程 git 时,它认为它是远程存储库的一个全新分支。我怎样才能恢复它?
Sorry for bad english. Thanks for any help.
抱歉英语不好。谢谢你的帮助。
采纳答案by Christopher
You've reversed the matching ref syntax, looks like. It should be <remote_ref>:<local_ref>
, but otherwise it looks like you're just attempting to pull biometric/try_merge
and force it into your local's try_merge
. Try this:
你已经颠倒了匹配的 ref 语法,看起来像。它应该是<remote_ref>:<local_ref>
,但否则看起来您只是试图将其拉入biometric/try_merge
并强行放入您本地的try_merge
. 尝试这个:
git checkout try_merge
git pull --force biometric try_merge
Otherwise I think this will work if you'd like to keep the matching ref syntax:
否则,如果您想保留匹配的 ref 语法,我认为这会起作用:
git pull biometric +try_merge:try_merge
Let me know in comments if these still throw your error, but either should work.
如果这些仍然抛出您的错误,请在评论中告诉我,但两者都应该有效。
回答by Andreas Bergstr?m
I had this issue and fixed it by simply removing the troublesome branch in .git/refs/remotes/origin/ and then do git fetch again.
我遇到了这个问题并通过简单地删除 .git/refs/remotes/origin/ 中的麻烦分支来解决它,然后再次执行 git fetch 。