Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

I am still getting this error message when I try to move my project tree on to git repo.

I checked the permissions of my directory with this project and these are set on 777. In the terminal in the directory with my_project I set:

git init

and then if I try

git add .


git commit -m "first upload"

so I'll get the error

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.

I tried to create a new repo and there to commit it, but unfortunately still the same error message.

What is the cause of the problem?

1 Answer

0 votes
by (50.2k points)

Try this command 

rm -f ./.git/index.lock

In your repository,

The error message is rather explicit as to what causes it typically, so if you have no other git processes running, delete the file. hope this helps.

For further reference regarding command refer: 

Browse Categories