600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > windows git fetch 时报错error: cannot lock ref ‘refs/remotes/origin/feature-1‘: there is a non-empty di

windows git fetch 时报错error: cannot lock ref ‘refs/remotes/origin/feature-1‘: there is a non-empty di

时间:2019-03-05 01:54:04

相关推荐

windows git fetch 时报错error: cannot lock ref ‘refs/remotes/origin/feature-1‘: there is a non-empty di

解决方式

看报错知道是存在feature-1这样的分支,导致在fetch或者pull的时候,发现该分支不为空而失败;同理其他cannot lock ref提示的错误也是相关分支异常导致。

处理手法,最简单的就是删除该分支即可,将feature-1分支删除,可以在本地.git上进入refs/remotes/origin删除,也可以直接到对应的gitlab或者github上直接删除该分支。

但上述只是快速解决方法,解决根因是因为:本例中报了 there is a non-empty directory ‘.git/refs/remotes/origin/feature-1’ blocking reference 'refs/remotes/origin/feature-1,即说明在fetch feature-1分支的时候,已经有了该分支文件夹,导致fetch不下来,而该命令去linux执行没问题,所以差异仅仅是windows和linux导致的。

结论:windows的git config默认是大小写不敏感,可以通过git config -l查看,发现core.ignorecase=true,意味着大小写不敏感。修改命令:

git config core.ignorecase false

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。