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


当前回答

有相同的消息,但有一个目录,在拉动时收到一条失败的消息。

git俯卧也帮不了我。原来有一个与远程创建的目录同名的文件。

必须转到.git\logs\refs\remotes\origin并删除区域设置文件-然后再次拉,一切正常。

其他回答

我正在使用Tower,不知为什么,我的文件夹名是.git/refs/remotes/origin/Github。将其更改为小写的.git/refs/remotes/origin/github解决了这个问题。

如果git-gc--prune=now对您没有帮助。(像我一样倒霉)

我所做的是在本地删除项目,然后重新克隆整个项目。

对我来说,它可以从.git/refs/remotes/origin/文件夹中删除引发错误的文件。

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

$ 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>".            

解释:您的远程repo(在GitHub/BitBucket中)分支似乎已被删除,尽管您的本地引用未被更新并指向不存在的引用。

为了解决这个问题:

git fetch --prune
git fetch --all
git pull

额外阅读-参考Git文档:

gitfetch-从另一个存储库下载对象和引用--全部取下所有遥控器。--修剪提取后,删除远程上不再存在的任何远程跟踪分支。