使用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远程梅干起源,但没用。


当前回答

对我来说,我有一个名为feature/phase2的本地分支,而远程分支名为feature/phase2/datamodel。命名冲突是问题的原因,因此我删除了我的本地分支(如果它有任何需要保留的内容,可以重命名它)

其他回答

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

转到颤振文件夹下,然后,

试试看:

git gc --prune=now

git remote prune origin

git pull

尝试使用以下方法清理本地存储库:

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

man git gc(1):

git-gc - Cleanup unnecessary files and optimize the local repository

git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]

       Runs a number of housekeeping tasks within the current repository, such as compressing file revisions
       (to reduce disk space and increase performance) and removing unreachable objects which may have been
       created from prior invocations of git add.

       Users are encouraged to run this task on a regular basis within each repository to maintain good disk
       space utilization and good operating performance.

man git远程(1):

git-remote - manage set of tracked repositories

git remote prune [-n | --dry-run] <name>

           Deletes all stale remote-tracking branches under <name>. These stale branches have already been
           removed from the remote repository referenced by <name>, but are still locally available in
           "remotes/<name>".            

对我来说,我有一个名为feature/phase2的本地分支,而远程分支名为feature/phase2/datamodel。命名冲突是问题的原因,因此我删除了我的本地分支(如果它有任何需要保留的内容,可以重命名它)

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

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

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

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