git pull :  git cannot lock ref    XXXXXX (unable to update local ref)


pull代码的时候出现的错误,导致代码拉不下来。 看了一下log。 提示git cannot lock ref XXXXXXXXXXXXXXXXXXXXXXXXXX unable to update local ref
错误原因:
打开git-bash, 输入 git branch -a 后发现远程有两个相同名字的分支。

解决方法:
方案1 : 删除掉远程重复名字的分支,在删除远程代码之前做好本地代码备份

git gc --prune=now
git remote prune origin
git pull

方案二: 更新一下本地的远端分支

git update-ref -d refs/remotes
git fetch

方案三: 进入到  .git/ refs /remotes/    , 删除掉本地的origin文件,重新拉取远端代码。


我这里选择的是第三种解决方案,因为我们的代码是多人开发的。远端的分支不确定能不能删掉,可能会影响别人的工作进度。
考虑到这方面的原因,我删除本地的远端代码,重新pull一下就可以了。

git pull时 git cannot lock ref XXXXXX (unable to update local ref)错误解决方案的更多相关文章

  1. git pull报“unable to update local ref”解决方案

    使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误. 除了重新clone一份代码外,还可以使用如下解决方案: 1. ...

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

    问题 由于有人rebase了分支,或者不知道怎么搞的.其他人拉取代码的时候,发现拉不下来. >git fetch error: cannot lock ref 'refs/remotes/ori ...

  3. 使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误。

    使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误. 除了重新clone一份代码外,还可以使用如下解决方案: .切 ...

  4. git (unable to update local ref )

    https://stackoverflow.com/questions/2998832/git-pull-fails-unable-to-resolve-reference-unable-to-upd ...

  5. 项目记事【Git】:git pull 出错 error: cannot lock ref 'refs/remotes/origin/feature/hy78861': is at d4244546c8cc3827491cc82878a23c708fd0401d but expected a6a00bf2e92620d0e06790122bab5aeee01079bf

    今天 pull 代码的时候碰到以下问题(隐去了一些公司敏感信息): XXX@CN-00012645 MINGW64 /c/Gerrard/Workspace/XXX (master) $ git pu ...

  6. git pull时的冲突解决方式; git stash; git fetch

    git fetch指令: https://www.yiibai.com/git/git_pull.html 发现远端有更新,git pull时,如果你本地分支修改了东西,导致git pull有冲突,失 ...

  7. git pull时解决分支分叉(branch diverged)问题

    git pull时出现分支冲突(branch diverged) $ git status # On branch feature/worker-interface # Your branch and ...

  8. 解决git pull时出现的几个问题

    第1个问题: 解决GIT代码仓库不同步 今天在执行git pull时出现: 解决方法:执行git checkout -f,然后再执行git pull重新checkout 再执行git pull时就可以 ...

  9. git常见问题之git pull时Please specify which branch you want to merge with.

    $ git pull时遇到如下提示 $ git pull warning: no common commits remote: Counting objects: 5, done. remote: C ...

随机推荐

  1. git添加doc文件维护

    原文地址:https://www.cnblogs.com/yezuhui/p/6853271.html 说明: git 一般只能对纯文本文件进行版本控制,但是如果有其他中间转化软件的协助,就可以对任意 ...

  2. Spring boot jpa 设定MySQL数据库的自增ID主键值

    内容简介 本文主要介绍在使用jpa向数据库添加数据时,如果表中主键为自增ID,对应实体类的设定方法. 实现步骤 只需要在自增主键上添加@GeneratedValue注解就可以实现自增,如下图: 关键代 ...

  3. Centos7 修改为阿里的yum源

    1.备份本地yum源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 2.获取阿里yum源配置文件 ...

  4. 【BZOJ4237】 稻草人 CDQ分治+单调栈

    ## 题目描述 JOI村有一片荒地,上面竖着N个稻草人,村民们每年多次在稻草人们的周围举行祭典. 有一次,JOI村的村长听到了稻草人们的启示,计划在荒地中开垦一片田地.和启示中的一样,田地需要满足以下 ...

  5. 如果判断条件过多,可以直接在computed里面去返回需要判断的数据

    bad <div class="offer-item_margin" v-show="offer.supplierName || offer.supplierSto ...

  6. hdoj - 2602 Bone Collector

    Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collec ...

  7. 蚂蚁Pincap头条

    去年(18年)年底想出来看看机会,最后很幸运地拿到了 PingCAP,今日头条的 offer 以及蚂蚁金服的口头 offer.想着可以总结一下经验,分享一下自己这一段”骑驴找马”过的心路历程.当然,一 ...

  8. CentOS下启动和停止Tomcat

    启动Tomcat: 进入tomcat目录/bin,然后./startup.sh 停止Tomcat: 进入tomcat目录/bin,然后./shutdown.sh

  9. 工具系列 | VScode VS Live Share 实时编码分享(和你的小伙伴一起写代码吧)

    Visual Studio Live Share能干啥? 分享任何语言,任何应用程序 无论您正在构建什么类型的应用程序,您正在编写什么语言,或者您的操作系统如何:在您需要协作时,Live Share会 ...

  10. top中的wa的理解

    CPU使用率:参考 mpstat 手册,%usr + %nice + %sys + %iwoait + %irq + %soft + %steal + %guest + %gnice + %idle ...