Unlink of file Failed. Should I try again?

前端 未结 30 3483
臣服心动
臣服心动 2020-12-02 03:44

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         


        
相关标签:
30条回答
  • 2020-12-02 04:18

    I had this kind of issue on Windows 7 and it turned out to be due to some orphaned git.exe process.

    To solve it, open Task Manager and kill all git.exe processes.

    Since git commands are short-lived, you should normally never see any git.exe in Task Manager. When they are there, it usually means something is wrong, and you should kill those processes.

    0 讨论(0)
  • 2020-12-02 04:18

    I ran into this issue running git Bash and Eclipse EGit at the same time. Solution: close Eclipse. Also wouldn't hurt to run git gc as @khilo mentioned.

    0 讨论(0)
  • 2020-12-02 04:20

    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

    set GIT_ASK_YESNO=false
    

    If the path is too long, I've not found a successful solution.

    0 讨论(0)
  • 2020-12-02 04:20

    I was able to solve this by opening Powershell as Administrator and from there git checkout <branch_name>

    0 讨论(0)
  • 2020-12-02 04:20

    I faced same issue while doing 'git pull'. I tried manual housekeeping git command 'git gc' and it resolved my problem.

    0 讨论(0)
  • 2020-12-02 04:21

    This may be a separate gitk window running to see some git history.

    Just close that window to fix that problem.

    0 讨论(0)
提交回复
热议问题