I am aware that there are similar issues about git relating to the ‘unable to unlink’ warning, but I have not been able to use them.
The main difference is that this happened when I have not been dealing with submodules in any way (I have never dealt with them before). I created a branch called ‘upgrade’, deleted my old framework files, and copied in the new ones. I used git add -A, then committed everything. When I tried to checkout the trunk branch, it responded with the following errors:
warning: unable to unlink requirements/views/sk/index.php: Permission denied
warning: unable to unlink requirements/views/sv/index.php: Permission denied
warning: unable to unlink requirements/views/zh/index.php: Permission denied
warning: unable to unlink requirements/views/zh_cn/index.php: Permission denied
warning: unable to unlink requirements/views/zh_tw/index.php: Permission denied
…etc. There are hundreds of them.
At first I thought this was simply a permissions problem, and so I added group write permissions to the entire requirements directory recursively, but there was no change.
Edit: As suggested in an answer below, I attempted to do the same thing but with everything else closed. I had no more luck than before.
This issue is particularly debilitating as I cannot move to trunk to get back to normal development.
I usually see that kind of error when there is a process not releasing the handle of those files.
Make sure nothing is running, and then try your checkout again.
Note: it can also be related with the way Git has been installed (on Windows, UAC can generate problem if msysgit is installed in
C:\ProgramorC:\Program Files, see “msysgit – sh.exe – fork: Permission denied – Vista 64 bit” and comment 2 of issue 437)Note: as illustrated below, a common other cause of the problem is rights issue on the directory (wrong owner), not necessarily on the file that can’t be unlinked.