使用 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 remote prune 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-remote(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
这使得 git 恢复了 ref 文件。在那之后,一切再次按预期工作。
这为我做了工作:
git gc --prune=now