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

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不一致的问题。

posted @ 2022-07-28 20:21  Code7Rain  阅读(2790)  评论(0编辑  收藏  举报