Something wrong is going on with one of the files in my local git repository. When I\'m trying to change the branch it says:
Unlink of file \'templates/media
In my case (Win8.1, TortoiseGit running), it was the process called "TortoiseSVN status cache" that was locking the file.
Killing it allowed me to run "git gc" without any more problems. The above process is fired up by TortoiseGit, so there is no need to manually restart it.
As stated above, something else is holding the files. Thing is that program doesnt look suspicious for us. I was trying to do a git pull from console, while having GitKraken opened. Closing GitKraken fixed the problem.
Worked for me, Tried on windows:
Stop your server running from IDE or close your IDE
Intellij/Ecllipse or any, it will work.
This could mean that another program is using the file, which is preventing git from "moving" the file into or out of the working directory when you are attempting to change branches.
I have had this happen on Windows Vista where eclipse is the program "using" the file. The file may not be actually open in eclipse but may have been opened by a process run by eclipse.
In this event, try closing the file in any applications that might have used it. If that doesn't work, completely exit any applications which may have opened the file.
After none of the above answers seemed to work, running git fetch -p
did the job for me.
https://git-scm.com/docs/git-fetch
I encountered this issue while doing a git pull
.
I tried git gc
and it resolved my problem.