使用git 1.6.4.2时,当我尝试git pull时,会出现以下错误:

error: unable to resolve reference refs/remotes/origin/LT558-optimize-sql: No such file or directory
From git+ssh://remoteserver/~/misk5
 ! [new branch]      LT558-optimize-sql -> origin/LT558-optimize-sql  (unable to update local ref)
error: unable to resolve reference refs/remotes/origin/split-css: No such file or directory
 ! [new branch]      split-css  -> origin/split-css  (unable to update local ref)

我尝试过git远程梅干起源,但没用。


当前回答

如果“无法更新本地参考”的错误再次出现,即使在应用Vojtech Vitek或Michel Krämer的答案后,您也可能在本地AND主存储库中有错误的参考。

在这种情况下,您应该应用两个修复程序,而不需要在两者之间拉或推。。。

rm .git/refs/remotes/origin/master
git fetch
git gc --prune=now
git remote prune origin

只有在推/拉之前应用两个修复程序后,我才能获得永久解决方案。

其他回答

我在作曲家更新方面也遇到了同样的问题。但对我来说,只有在我清除了composer缓存并删除了供应商文件夹的内容后,它才起作用:

rm -rf vendor/*
git gc --prune=now
git pull
composer clear-cache
composer update my/package

如果有人觉得这很有用,我会长期遇到这个问题,虽然不是经常出现,因为我在Dropbox中有git目录,从Dropbox中删除了它,一切都很好。

尝试了这些,但没有对我起作用:

$ git gc --prune=now
$ git remote prune origin
$ git fetch --prune

我不得不通过删除本地文件夹并再次克隆来解决这个问题。

简单地说,当您的本地人有一些关于远程的信息,并且有人更改了一些使远程和您的更改不同步的内容时,就会出现此问题。

我遇到这个问题是因为有人删除了远程分支,并再次创建了同名分支。

要处理此类问题,请从远程进行拉取。

git remote prune origin

或者,如果您正在使用任何GUI,请从远程执行提取。

试试看:

git pull origin Branch_Name

Branch_Name,您当前所在的分支。

如果您只执行一个git pull,它也会提取所有其他创建的分支名称。

所以你得到这个的原因是:

! [new branch]      split-css  -> origin/split-css  (unable to update local ref)