Git rebase 出现“取消文件链接失败”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3698369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 09:06:11  来源:igfitidea点击:

Git rebase got 'unlink of file failed' error

git

提问by Stan

Using msysgit 1.7.0.2, when doing git rebase -i, it hangs and there's no message.
After enter ctrl+c, I can see

使用msysgit 1.7.0.2,在执行时git rebase -i,它挂起并且没有消息。
进入后ctrl+c,我可以看到

'unlink of file failed, should I try again (y/n)?'

Then I tried git rebase --abortbut got same error message. So now it's stuck in the middle of rebase process. This error seems to be caused by read-only file.

然后我尝试git rebase --abort但收到相同的错误消息。所以现在它被困在 rebase 过程的中间。此错误似乎是由只读文件引起的。

Is there any way to resolve this issue?

有没有办法解决这个问题?

回答by VonC

Did you try with set GIT_ASK_YESNO=false?

你试过set GIT_ASK_YESNO=false吗?

This Google group threadmentions it in the recent mingw evolutions:

这个Google 群组线程在最近的 mingw 演变中提到了它:

Make use of the new environment variable GIT_ASK_YESNOto support the recently implemented fallback in case unlink, renameor rmdirfail for files in use on Windows.

利用新的环境变量GIT_ASK_YESNO来支持最近实施的回退,以防万一unlinkrenamermdir在 Windows 上使用的文件失败。

What exact version of Git for windows are you using?
Note: msysgit setup is not the same than the "Git for Windows" setup, see also "Different between msysgit and cygwin + git ?")

您使用的 Windows 版 Git 的确切版本是什么?
注意:msysgit 设置与“Git for Windows”设置不同,另请参见“ msysgit 和 cygwin + git 之间的区别?”)



git 2.8.4 (June 2016)does mention issue 755which should also alleviate the issue (commit 2db0641):

git 2.8.4(2016 年 6 月)确实提到了问题 755,这也应该可以缓解这个问题(提交 2db0641):

Make sure temporary file handles are not inherited by child processes

确保子进程不会继承临时文件句柄



See also Git 2.19 (Q3 2018): "Git - Unlink of file .idx and .pack failed (The only process owned handle to this file is git.exe)".

另请参阅 Git 2.19(2018 年第三季度):“ Git - 文件 .idx 和 .pack 的取消链接失败(该文件的唯一进程拥有句柄是 git.exe)”。

回答by Steve Almond

I don't know if it applies in your situation, but I've just had a similar situation with 1.7.10.msysgit.1 (talking to a network share on an Ubuntu server). In my case, a failed merge had made several objects owned by root with permissions -r--rwSr--. A simple SSH login and

我不知道它是否适用于您的情况,但我刚刚遇到了与 1.7.10.msysgit.1 类似的情况(与 Ubuntu 服务器上的网络共享交谈)。就我而言,失败的合并使 root 拥有的多个对象具有 -r--rwSr-- 权限。一个简单的 SSH 登录和

sudo chown steve: .git/*

fixed one problem (for my user - unless you're called steve, you'll need to change that to your username!), and

修复了一个问题(对于我的用户 - 除非你叫 steve,否则你需要将其更改为你的用户名!),以及

chmod -R 0755 .git/*

fixed the other.

固定另一个。