Not every time, but quite often, I get this fatal error when trying to switch branches in my repository:
git -c diff.mnemonicprefix=false -c core.quotepath=false checkout <branch-name>
fatal: Unable to create 'D:/Evi/Source/Git/.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 think the problems started after I updated the Git-for-Windows version from 1.9.5 to 2.5.x and prevailed in 2.6.x. Restarting SourceTree solves the issue (temporarily). I noticed that the latest SourceTree version 18.104.22.168 still downloads the 1.9.5 preview version when I try switching to Embedded Git.
So, is this an incompatibility issue of SourceTree with Git-for-Windows 2.x? A Fix really would be appreciated since having to restart SourceTree gets quite annoying. The issue exists on multiple machines in our company.
This error is really annoying and the error message is wrong. Any time I get this error message there is no index.lock file. If I open the Git Terminal from SourceTree and execute the same command the branch is switched correctly. As Rainer already mentioned the error is not permanent and can be worked around be restarting SourceTree.
My system git version is still at 1.9.5 and if I switch SourceTree to use this version changing branches works perfectly but then I can no longer access the Git bash terminal from SourceTree. I recently updated SourceTree to 1.6.23 and I did not encounter this problem in earlier versions.
I also get this error nearly every day. If I watch the .git folder during an operation, I can see the index.lock briefly get created and then deleted. It's a race condition in git and/or Sourcetree.
Also, it appears to be something that is actually caused by SourceTree because I don't get the problem if I use Git on the command line.
Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot