PyCharm中去调试一个Python的Flask项目,
后来不知道什么原因,导致了此处去git commit或git rm,都提示出错:
1 2 3 4 5 6 7 8 | ➜ xxxRobotDemoServer git:(master) ✗ git rm .idea/* fatal: Unable to create '/Users/crifan/dev/dev_root/company/xxx/projects/robotDemo/server/xxxRobotDemoServer/.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 . |

git fatal: Unable to create .git/index.lock’: File exists
1 2 3 4 5 6 7 8 9 10 | ➜ xxxRobotDemoServer git:(master) ✗ ls -lha ./.git /in * -rw-r--r-- 1 crifan staff 8.9K 8 26 14:00 ./.git /index -rw-r--r-- 1 crifan staff 0B 8 27 09:30 ./.git /index .lock ./.git /info : total 8 drwxr-xr-x 3 crifan staff 96B 5 18 15:48 . drwxr-xr-x 14 crifan staff 448B 8 27 09:30 .. -rw-r--r-- 1 crifan staff 240B 5 18 15:48 exclude ➜ xxxRobotDemoServer git:(master) ✗ rm -f ./.git /index .lock |
【总结】
此处git操作提示出错:
fatal: Unable to create .git/index.lock’: File exists
那就去删除掉那个lock文件即可:
1 | rm -f ./.git /index .lock |
转载请注明:在路上 » 【已解决】git commit失败:fatal: Unable to create .git/index.lock’: File exists