Unlink of file Failed. Should I try again?
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/container.html' failed. Should I try again? (y/n)
What could that mean?
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.
Read more... Read less...
I had this issue and solved it by the command :
The above command remove temp and unnecessary files. (Garbage collector.)
this solution from here worked for me:
This is a Windows specific answer, so I'm aware that it's not relevant to you... I'm just including it for the benefit of future searchers.
In my case, it was because I was running Git from a non-elevated command line. "Run as Administrator" fixed it for me.
I encountered this issue while doing a
git gc and it resolved my problem.
In my case there are no processes touching the file or directory. Maybe it happens if the path is very long, because an operating system restriction (windows). Try enabling the longpath support flag in the global git configuration as indicated below:
git config --global core.longpaths true
or try to setting the yes/no answer flag if it is not conflictive for you
If the path is too long, I've not found a successful solution.
As i am using gitkraken and command prompt, i ran into the same issue. And then i run
git gc command it resolved my problem. So i am happy and want share some of the points which might be helpful.
git gc will do ?
git gc removing unreachable objects which may have been created from prior invocations of git add.
When to run
From doc, users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.
How to make it auto-configurable?
Some git commands may automatically run git gc; see the --auto flag below for details. If you know what you’re doing and all you want is to disable this behavior permanently without further considerations, just do
git config --global gc.auto 0