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


当前回答

$ rm .git/refs/remotes/origin/master

$ git fetch

来自bitbucket.org:xx/mkyong教程

df0eee8..3f7af90  master     -> origin/master

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

对我来说,我是这样解决的:

rm .git/refs/remotes/origin/master
git fetch

之后,我从github收到了这条消息。

没有当前分支的跟踪信息

所以接下来我做的是:

git branch --set-upstream-to=origin/master master
git pull

这对我来说很有用:

git gc --prune=now

我也遇到过同样的问题,并通过查找出错的文件来解决:

\repo\.git\refs\remotes\origin\master

这个文件充满了null,我用github的最新引用替换了它。

今天刚遇到问题。

故障排除方法:使用Windows服务器上的SourceTree,您可以尝试以管理员身份运行它。这解决了我在域中Windows Server 2012 R2上的Atlassian源树2.1.2.5上“无法更新本地引用”的问题。

如果您也可以复制这种情况,则证明问题是由权限问题引起的。最好深入研究并找到根本原因-可能某些特定文件是由其他用户等拥有的-否则会有一个不受欢迎的副作用:您将不得不以管理员身份运行SourceTree。