I usually use git-bash to manage source code from my windows desktop. When I am done, I close the git-bash window or run the exit command.
Then, I noticed that a good number of folders used for git projects are locked by git. The only way to release the lock is to kill the git process.
Is there a way close git and all its processes when done using git?
Now, I am using PowerShell to track locked files and kill the related processes:
PS> openfiles /query | find "folder-name"
PS> taskkill /im git.exe
Note: I noticed the file lock using Windows Process Explorer File Handle Search utility. I had to run the utility with Admin privileges for this feature to find the locks. See the snapshot below.
I appreciate your help.
Installing a new version of Git for Windows and disabling the file system watcher should fix the directory locking (this affects the core.useBuiltinFSMonitor
setting):