title: git本地空间损坏
date: 2024-11-29 21:00:00
permalink: /pages/2s1d1c63/
sidebar: auto
categories:

  • 随笔

tags:

  • 工作

author:

name: 溪初

git本地空间损坏

  • 错误描述:git pull : error: cannot lock ref 'refs/remotes/origin/*' (unable to update local ref)
  • 错误结论:git pull 报错不能更新本地分支
  • 错误分析:本地分支跟远程分支不匹配 导致更新失败
  • 解决方案
  • 备份自己修改的代码,本地创建分支
  • 找到.git\refs\remotes (文件路径)对应删除你报错的分支
  • git checkout **(不要在你报错的分支上面 切到其他分支上)
  • git featch -p (拉取远程分支)
  • git pull (当前分支不是报错的分支 执行pull操作 是否正常)
  • git branch -D **(报错的分支名)
  • git checkout **(报错的分支名)
  • git pull

参考链接