Usually we get this error when we attempt to add files to our repositories. This error happens because of the lock files stored in our project file. Normally these files automatically remove from our projects. But this could be happen if it is crashed or somehow stopped suddenly without cleaning itself.

So to avoid this error first you have to check all running processes to make sure that there isn’t any Git process running in the background that is still keeping the lock file open. If there any end those tasks.

If the error still appears, we should find the hidden directory called .git inside your project. In .git directory there should be a file called index.lock.

index.lock file stored inside the .git directory

Simply you can remove this file using your delete button or you can use ‘git rm’ command to remove the file.

Software engineering undergraduate