无法创建' D:/本地开发/ Shiva / shiva-tutorials / .git / index.lock':文件存在

时间:2017-01-02 10:00:16

标签: git heroku

我关注了许多像Git - fatal: Unable to create '/path/my_project/.git/index.lock': File exists.这样的链接,但没有一个像我这样的工作。当我尝试将它们提交到GIT存储库时,我在两个项目之下

 /d/Local Development/Shiva/shiva-tutorials/springboot-heroku-docker (master)
$ ls -ltra
total 9
-rw-r--r-- 1 541344 1049089 664 Aug 30 10:46 pom.xml
drwxr-xr-x 1 541344 1049089   0 Jan  2 15:12 ../
drwxr-xr-x 1 541344 1049089   0 Jan  2 15:12 ./
drwxr-xr-x 1 541344 1049089   0 Jan  2 15:14 springboot-heroku-demo/
drwxr-xr-x 1 541344 1049089   0 Jan  2 15:14 springboot-mysql-docker-demo/

我开始看到以下错误,不确定哪里出错了?事实上,我没有看到任何.git /文件夹被删除。请指导我。

enter image description here

命令行错误:

/ d / Local Development / Shiva / shiva-tutorials / springboot-heroku-docker(master)

$ git add *
fatal: Unable to create 'D:/Local Development/Shiva/shiva-tutorials/.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.

2 个答案:

答案 0 :(得分:1)

您可以使用它
rm -f ./.git/index.lock

答案 1 :(得分:0)

以点(.)开头的文件根据定义隐藏在linux文件系统中。因此,您没有看到.git ls -ltra,因为您没有列出隐藏文件。使用ls -ltrah,您会看到.git文件夹。但是删除.git文件夹,但只删除其中的index.lock文件。当我遇到这个问题时,我通常会在锁定时杀死一个Git进程并正在做一些工作,这会使文件保持原位并且repo被锁定。

相关问题