I\'m using git, and made a small commit followed by a large one. I decided to use git rebase
to squash the two commits together before pushing them. (I\'ve ne
Killing the w3wp.exe process related to the repository fixed this for me.
On Windows, it can be a TortoiseGIT process that blocks those files. Open task manager and end process TGitCache.exe.
This can also happen when you're using SublimeText and the popup window asking you to buy the program is not closed.
An alternate solution rather than closing all apps that might be locking the directory as just about every other answer says to do, would be to use a utility that will unlock the files/directory without closing everything. (I hate needing to restart Visual Studio)
LockHunter is the one that I use: https://lockhunter.com/ There are likely others out there as well, but this one has worked great for me.
Happened to me on Windows while rebasing inside IntelliJ integrated terminal. I noticed that I had Git bash client instance running in parallel.
Closing Git bash solved the problem.
I had a similar problem. But it was very simple to resolve. On a Windows machine, my file explorer had a folder open that existed in one branch but not in the other I checked out. Closing the File explorer resolved the problem.