git pull fails “unable to resolve reference” “unable to update local ref”

简介:

问题

由于有人rebase了分支,或者不知道怎么搞的。其他人拉取代码的时候,发现拉不下来。

>git fetch

error: cannot lock ref 'refs/remotes/origin/xxx-branch': is at 8117caf7b1c88b2d5dfebd7581f6891d87b9abee but expected f38e8d35ae8ea7f177c537a98f4140dd76b8e2bd
From xxxxxxx-git-url
 ! f38e8d35..9d7b8e7a  xxx-branch -> origin/xxx-branch  (unable to update local ref)

解决方案

尝试clean本地git

$ 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= | --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]

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

本文转自Ryan.Miao博客园博客,原文链接:http://www.cnblogs.com/woshimrf/p/git-pull-fails-unable-to-resolve-reference-unable-to-update-local-ref.html,如需转载请自行联系原作者

相关文章
|
Docker 容器
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
2015 0
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
error: Your local changes to the following files would be overwritten by merge
error: Your local changes to the following files would be overwritten by merge
|
4月前
|
Kubernetes 容器
k8s-error execution phase upload-config/kubelet: Error writing Crisocket...
k8s-error execution phase upload-config/kubelet: Error writing Crisocket...
32 0
|
5月前
|
开发工具 git
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
103 0
|
开发工具 git
完美解决 fatal: unable to access ‘https://github.com/.../.git‘: Could not resolve host: github.com
完美解决 fatal: unable to access ‘https://github.com/.../.git‘: Could not resolve host: github.com
11434 0
|
开发工具 git
error: could not lock config file .git/config: Permission denied/Command failed with exit 255
error: could not lock config file .git/config: Permission denied/Command failed with exit 255
281 0
|
网络协议 关系型数据库 Linux
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
144 0
|
Android开发
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
346 0
解析Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
|
Perl
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`. Y...
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`. Y...
974 0
|
开发工具 git
关于 error: refname refs/heads/master not found 的问题
关于 error: refname refs/heads/master not found 的问题
676 0