Git Add问题

Git*_*ser 1 git cloud9-ide

我最近开始使用Cloud9 IDE.我使用Git作为版本控制,它工作正常,直到最近我尝试了这个命令:

git add .
Run Code Online (Sandbox Code Playgroud)

它因以下错误而失败:

ubuntu:~/workspace (master) $ git add .
fatal: Unable to create '/home/ubuntu/workspace/.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.
ubuntu:~/workspace (master) $ 
Run Code Online (Sandbox Code Playgroud)

我有sudo权限,使用sudo上面的命令给我其他错误.索引不会更新.它仍然显示我喜欢修改,但没有添加.

疯狂的部分是,该文件.git/index.lock不存在,当我试图找到是否有任何git进程在后台运行时,使用top或者ps grep,我找不到任何进程.

我在Cloud9环境中使用Ubuntu 14.04 LTS.我是RW权限的合作者之一,但我没有重新启动权限.我尝试了以下但它们不起作用:

sudo reboot
sudo shutdown -r now
Run Code Online (Sandbox Code Playgroud)

请让我知道如何继续.我需要尽快部署代码.顺便说一句,这是我的第一篇文章,以及我在这里也看过类似的帖子:

Pra*_*man 5

尝试使用:

sudo chmod 755 -R .git
sudo chown -R ubuntu:root .git
Run Code Online (Sandbox Code Playgroud)

如果文件不存在,则为true.看起来像是一个许可问题.

  • @GitUser你必须在某个时候以root身份运行git命令,这会影响.git目录中的权限. (2认同)