In my case, this was caused by using the same Git repo from both admin and non-admin command prompts. When last git pull was from admin cmd, the index was created by it, and then non-admin cmd had insufficient permissions to modify it.

My solution was re-creating the index (while keeping the worktree intact):

del .git\index
git reset --mixed head

 

自己尝试的方案

遇到的问题是,使用git status会报这个错误

因为git bash是直接安装到环境变量的,用管理员权限打开powershell,然后在powershell里面执行git status就不会报错了。

 

相关文章: