1

This .git/index.lock file automatically gets created whenever git add . command is given in Git bash.

Even after deleting the file manually, and it generates lots of warnings.

How can I resolve this, and use git push?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Please post the command that you executed and any message that git throws. – Asif Kamran Malick Apr 04 '21 at 19:45
  • [what are lockfiles?](https://fileinfo.com/extension/lock) – 0xLogN Apr 05 '21 at 02:07
  • It's normal for Git to create `.git/index.lock`. But normally Git *deletes or renames* the file afterward, to release the lock. This should Just Work and you should not have to delete `.git/index.lock`. If it's not working, you should include additional details about the problem, because we can't *guess* why it's not working. See [ask]. – torek Apr 05 '21 at 02:33

1 Answers1

0

It depends on the local system (OS, server type, disk space, ...), as illustrated in "git index.lock File exists when I try to commit, but cannot delete the file".

It can be a process keeping an handle to the lock file, or it can be a permission issue.

So before trying a git push, you must first understand why the index.lock file remains.

As I mention in "if git index.lock exist, can I safely delete it, or are more actions needed to verify integrity?", a workaround is to delete it manually, before pushing.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250