git add 时出现错误

fatal: Unable to create ‘/xxx/xxxx/.git/index.lock’: File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by ‘git commit’. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

  1. 在资源管理器中打开自己的项目
  2. 再打开项目目录下的.git文件,默认.git文件是隐藏的,需要设置成显示隐藏文件才能看到,具体做法可以参考别的帖子
  3. 删除.git目录下的index.lock文件
  4. 再次git add xxx 就可以了

猜你喜欢

转载自blog.csdn.net/achao_2020/article/details/106945219