Unlink of file Failed. Should I try again?

前端 未结 30 3484
臣服心动
臣服心动 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:30

    I had this issue with .tmp files in /.git/objects/pack folder. I think something had failed during a push or pull, so I removed these temporary files and reset the HEAD to my last commit. Not sure if this is advised but it worked for me. Also git count-objects -v gave me a list of the .tmp files that didn't belong in the pack folder.

    Or to suppress the y/n messages in windows git open cmd.exe and run:

    SETX GIT_ASK_YESNO false
    

    seen here: https://twitter.com/petercamfield/status/494805475733807104

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

    On Windows 8: I ran git gc and it said git gc was already running, I ran git gc --force and the garbage collector ran.

    I could then switch branches and merge without any issues, try git gc --force.

    Perhaps the gc process didn't stop gracefully for one reason or another.

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

    After run command

    git rm -rf foo.bar
    

    I see error

    Unlink of file 'foo.bar' failed. Should I try again? (y/n)
    

    Because another program is using this file. For example, when I run Java web application in debug model or run web application on server, I can't delete log file. Turn off application sever (or turn off debug process), re-try

    git rm -rf foo.bar
    

    I see file has been deleted.

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

    If closing your IDE and running various git commands listed here won't help, try manually killing all running Java processes. I had a Java process probably left over from eclipse that somehow kept a configuration file open.

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

    I had this issue and solved it by the command : git gc The above command remove temp and unnecessary files. (Garbage collector.)

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

    I tried git gc and it resolved my problem.

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