【发布时间】:2011-12-13 05:30:38
【问题描述】:
当我尝试将项目树移至 git repo 时,我仍然收到此错误消息。
我用这个项目检查了我的目录的权限,这些权限设置在 777 上。在带有my_project 的目录的终端中,我设置了:
git init
然后如果我尝试
git add .
或
git commit -m "first upload"
所以我会得到错误
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.
我也尝试创建一个新的 repo 并在那里提交它,但不幸的是仍然出现相同的错误消息。
问题的原因是什么?
【问题讨论】:
-
我遇到了这个问题,因为我在另一个终端使用 su 登录,然后切换回第一个一切正常
-
兄弟我有同样的问题,使用“sudo git add . or git commit -m "first upload" "而不是" git add . or git commit -m "first upload" "
-
我通过更改每个 stackoverflow.com/questions/14127255/… 的 .git 文件的权限来修复它,请参阅 Mahshid Zeinaly 的回答
标签: git