Git报错:fatal Unable to create xxx目录.git index.lock File exists

git执行add命令是报错:

$ git add -A .
fatal: Unable to create 'xxx目录/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

最简单的处理就是重启电脑,因为你操作了两个git的工作空间,其中前一个git的线程没有退出,所以再操作第二个,提示了当前内容。