Git User
Git User

Reputation: 23

Issue with Git Add

I recently started using Cloud9 IDE. I am using Git as version control and it was working fine, until recently I tried this command:

git add .

And it failed with this following error:

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

I do have sudo permissions and using sudo with the above command gives me other errors. The index doesn't get updated. It still shows me like modified, but not added.

The crazy part is, that file .git/index.lock doesn't exist and also when I tried to find if there are any git processes running in the background, using top or ps grep, I couldn't find any.

I am using Ubuntu 14.04 LTS in Cloud9 Environment. I am one of the collaborators with RW permission, but I don't have restart rights. I tried the following but they do not work:

sudo reboot
sudo shutdown -r now

Kindly let me know how to proceed. I need to deploy the code soon. By the way, this is my first post, as well as I have also seen similar posts here:

Upvotes: 1

Views: 176

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167250

Try using:

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

This is true if the file doesn't exist. Looks like a permission issue to me.

Upvotes: 5

Related Questions