[Bug0034] Git报错 cannot lock ref 'refs/heads/master': is at xxxx but expected xxx error:

2022/7/28 23:24:27

本文主要是介绍[Bug0034] Git报错 cannot lock ref 'refs/heads/master': is at xxxx but expected xxx error:,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、问题

error: update_ref failed for ref 'refs/heads/master': cannot lock ref 'refs/heads/master': is at 63654e79f7ae0f902731558b3ae6679a69db09e9 but expected ec20d6ffa52920358e54703f90100bedbca4c855 error: could not update refs/heads/master

2、场景

由于为了方便解决冲突获取到最新远程代码(并且本地有冲突代码不想要),直接删除了本地分支想重新创建同名分支,导致报错。

3、原因

问题不能复现待补充

4、解决方案

参考文章0

参考文章1

5、扩展

熟悉windows系统的话,windows下,文件名不区分大小写,所以导致它们两个文件不能共存。

Git是区分大小写的,所以可以存在两个大小写不同但名字是一样的分支。

Windows系统的文件,是不区分大小写的,导致.git\refs\remotes\origin下只存在小写的文件,以致于git pull时commit id不一致的问题。



这篇关于[Bug0034] Git报错 cannot lock ref 'refs/heads/master': is at xxxx but expected xxx error:的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程