首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法创建‘D:/本地Development/Shiva/shiva-tutorials/.git/index.lock':文件

无法创建‘D:/本地Development/Shiva/shiva-tutorials/.git/index.lock':文件
EN

Stack Overflow用户
提问于 2017-01-02 10:00:15
回答 3查看 328关注 0票数 1

我跟踪了许多像project/.git/index.lock': File exists.这样的链接,但是没有一个是为我工作的。当我尝试将两个项目提交到GIT存储库时,我已经完成了以下两个项目

代码语言:javascript
复制
 /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/文件夹被删除。请引导我。

命令行错误:

/D/本地Development/Shiva/shiva-tutorials/springboot-heroku-docker (主版)

代码语言:javascript
复制
$ 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.
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2017-01-02 12:10:24

从定义上看,以点(.)开头的文件隐藏在linux文件系统中。因此,您没有看到.gitls -ltra,因为您没有列出隐藏的文件。使用ls -ltrah,您将看到.git文件夹。但是,不要删除.git文件夹,而只删除其中的index.lock文件。当这个问题发生在我身上时,我通常会在Git进程有锁的时候杀死它,并做一些工作,这将使文件处于位置并锁定回购程序。

票数 0
EN

Stack Overflow用户

发布于 2020-07-19 09:42:37

你可以用它

rm -f ./.git/index.lock

票数 1
EN

Stack Overflow用户

发布于 2022-09-12 00:56:39

运行:

代码语言:javascript
复制
git rev-parse --git-dir

然后你会得到.git

然后跑:

代码语言:javascript
复制
rm  ./.git/index.lock 

若要删除锁定文件,请执行以下操作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41424620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档