2016-04-28 60 views
1

我最近开始使用Cloud9 IDE。我使用Git版本控制和它做工精细,直到最近我试过这个命令:问题与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不存在,也当我试图寻找是否有在后台运行,使用topps grep任何git过程中,我找不到任何。

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

sudo reboot 
sudo shutdown -r now 

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

+0

你能手动进入目录并检查文件吗?并用'sudo rm -f index.lock'删除?它通常是隐藏的。 –

+0

@PraveenKumar号码该文件根本不存在于该位置。 –

+0

你可以尝试使用像'ls -la'或类似的过滤器吗? –

回答

5

尝试使用:

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

这是如果文件不存在,则为true。看起来像一个权限问题给我。

+1

感谢您的回答。让我看看这是否有效。 –

+0

哇!这工作。为什么是这个问题? –

+0

@GitUser正如人们在评论中提到的那样,这是因为权限问题。通常Cloud9 IDE是稳定的,我不确定你是如何进入这个问题的。 –