Git Add问题

时间:2016-04-28 10:59:35

标签: git cloud9-ide

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

git add .

以下错误导致失败:

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) $ 

我拥有sudo权限,使用sudo上述命令会给我带来其他错误。索引没有更新。它仍然显示我喜欢修改,但没有添加。

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

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

sudo reboot
sudo shutdown -r now

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

1 个答案:

答案 0 :(得分:5)

尝试使用:

sudo chmod 755 -R .git
sudo chown -R ubuntu:root .git

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