Git: fatal: Unable to create 'xxx/.git/index.lock': File exists.

"D:\Program Files\Git\bin\git.exe" checkout -b "gyn_xxx" "34e90a68"
fatal: Unable to create 'D:/xxx/xxx/.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.
Done

Press Enter or Esc to close console...

从仓库里clone了一个老的项目下来,新建分支和checkout都报这个错,
百度,google了发现都是叫删除 index.lock文件的和重启电脑,试了下还是不行,

最终在http://stackoverflow.com/questions/7860751/git-fatal-unable-to-create-path-my-project-git-index-lock-file-exists
这里找到了一种可行的方式:

就是设置文件的权限

Paste_Image.png

将项目的权限设为everyone可以全部操作,重新checkout后可行了。

推荐阅读更多精彩内容