1

As title said, using GIT with Unity always create index.lock file, and every time try to commit my changes, it shows me:

fatal: Unable to create 'F:/dev/unity/test/my-game/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

I already try to manually delete index.lock file inside of .git directory thousand times, but it's worthless. Because when I delete them, I loose all staging files, so I redo "git add ." again, and "git commit" gives same error, index.lock exists.

So I try to kill other git processes but there's no other git process alive. I already re-created whole repository and try to commit several times but always having same problem!

I made another repo and try add & commit with single text file works fine, seems like it only happens in my game project. I guess that it has lots of files(almost 1.3GB), so after "git add ." seems like git crashed. I'm not sure because I couldn't find any git process remains, but there's index.lock file always and never gone.

I can't find any related information about this. I'm stuck in here almost 3 days and found nothing. What am I missing?

modernator
  • 4,341
  • 12
  • 47
  • 76
  • This is weird, have you removed all instances of git from this project? so removing the entire .git directory in your entire folder structure, and reinitializing it? – AresCaelum Apr 09 '19 at 15:58
  • @Eddge Yes, I already remove whole .git directory three times and redo all process. Still have this issue. – modernator Apr 09 '19 at 16:03
  • that is weird, the closest thing I can find to what you are talking about is this: https://stackoverflow.com/questions/9282632/git-index-lock-file-exists-when-i-try-to-commit-but-cannot-delete-the-file not sure if this will be helpful, as in your case are able to delete the file, but I would probably check the answer that mentions using powershell to make sure all the git processes are closed... – AresCaelum Apr 09 '19 at 16:08
  • 1
    @Eddge Possibly it happens because too much files to add. I'm trying to add and commit & push only single directory each time, and seems like it works now. Still it dies in some directory which have almost 1000+ files but retry push seems work. Possibly bug of git in windows. – modernator Apr 09 '19 at 16:19
  • @Eddge Nah, it's not. First it seems work, but now have same error. – modernator Apr 09 '19 at 16:45

1 Answers1

0

Problem solved simply by updating Windows Git to latest version 2.21.0. Now using "git add ." and commit works fine without any error.

modernator
  • 4,341
  • 12
  • 47
  • 76