0

Eclipse is showing the below error when I select to add a file to index. Is there any way to fix this?

Failed to add resource to index
    Failed to add resource to index
    Exception caught during execution of add command

Eclipse error message

Below is the stack trace of the exception:

org.eclipse.core.runtime.CoreException: Failed to add resource to index
    at org.eclipse.egit.core.op.AddToIndexOperation.execute(AddToIndexOperation.java:80)
    at org.eclipse.egit.ui.internal.actions.AddToIndexActionHandler$1.run(AddToIndexActionHandler.java:57)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of add command
    at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:252)
    at org.eclipse.egit.core.op.AddToIndexOperation.execute(AddToIndexOperation.java:77)
    ... 2 more
Caused by: org.eclipse.jgit.errors.LockFailedException: Cannot lock C:\Users\kkuma203\git\voice-war-nwp-pluto\.git\index
    at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:250)
    at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:327)
    at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:293)
    at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:1192)
    at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:148)
    ... 3 more
howlger
  • 31,050
  • 11
  • 59
  • 99

1 Answers1

1

Solved this error by manually deleting index.lock file. I am now able to add files to index.

The file is located at /home/user/location/.git/index.lock.

howlger
  • 31,050
  • 11
  • 59
  • 99