Git - 致命:无法创建“/path/my_project/.git/index.lock":文件存在 [英] Git - fatal: Unable to create '/path/my_project/.git/index.lock': File exists

查看:24
本文介绍了Git - 致命:无法创建“/path/my_project/.git/index.lock":文件存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将我的项目树移动到 git repo 时,我仍然收到此错误消息.

I am still getting this error message, when I try to move my project tree on to git repo.

我用这个项目检查了我的目录的权限,这些权限是在 777 上设置的.在带有 my_project 的目录中的终端中,我设置了:

I checked the permissions of my directory with this project and these are set on 777. In terminal in the directory with my_project I set:

git 初始化

然后如果我尝试

git add .

git commit -m 第一次上传"

所以我会得到错误

fatal: Unable to create '/path/my_proj/.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.

我还尝试创建一个新的存储库并在那里提交它,但不幸的是仍然出现相同的错误消息.

I tried also create a new repo and there to commit it, but unfortunately still the same error message.

问题的原因是什么?

推荐答案

尝试

rm -f ./.git/index.lock

在您的存储库目录中.错误消息对于通常导致它的原因非常明确,因此如果您没有其他 git 进程正在运行(这是正常情况),请继续并删除该文件.

In your repository directory. The error message is rather explicit as to what causes it typically, so if you have no other git processes running (which is the normal case), go ahead and delete that file.

这篇关于Git - 致命:无法创建“/path/my_project/.git/index.lock":文件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆