[英]GIT can't pull: failed to symlink 'path/filename': File name too long
Feeling silly, but I can't figure out what to do here. 感觉很傻,但我不知道该怎么做。
I have a local copy of a repository stored on a remote server. 我有一个存储在远程服务器上的存储库的本地副本。 The remote server has changes I need, and I've committed changes on my local copy.
远程服务器有我需要的更改,并且我已在本地副本上提交了更改。 I can't push, because I need to merge the changes from the newer version that exists on the server.
我无法推送,因为我需要合并服务器上存在的较新版本的更改。 When I pull, I get this error:
当我拉,我得到这个错误:
git pull origin master
From server.name:reponame
* branch master -> FETCH_HEAD
fatal: failed to symlink 'path/to/filename ': File name too long
Not sure what would be happening here. 不知道这里会发生什么。 The crazy thing is that the file
path/to/filename
is an actual file, not a symlink. 疯狂的是文件
path/to/filename
是一个实际文件,而不是符号链接。 Further, path/to/filename
isn't even the longest path. 此外,
path/to/filename
甚至不是最长的路径。
Really confused as to where to start debugging this problem. 真的很困惑,从哪里开始调试这个问题。
The only place where I see a failed to symlink is in the merge-recursive.c file : 我看到无法符号链接的唯一地方是merge-recursive.c文件 :
if (S_ISLNK(mode)) {
char *lnk = xmemdupz(buf, size);
safe_create_leading_directories_const(path);
unlink(path);
if (symlink(lnk, path))
die_errno(_("failed to symlink '%s'"), path);
free(lnk);
}
It looks like the remote repo you are pulling from contains filename
as a symlink, while your local repo contains the same filename
as a plain file. 看起来你要拉的远程仓库包含
filename
作为符号链接,而你的本地仓库包含与普通文件相同的filename
。
That could be the cause of the fatal error message. 这可能是导致致命错误消息的原因。
I'd start debugging by beginning with git fetch
and only after that succeeds, go for git merge
. 我将从
git fetch
开始调试,只有在成功之后,才能进行git merge
。 Presumably (as @VonC noted) the error will only happen with git merge
(which makes sense since pull is just fetch-then-merge here). 据推测(正如@VonC所说),错误只会发生在
git merge
(这是有道理的,因为pull只是fetch-then-merge)。 Since the fetch
will have succeeded, you can inspect the commit(s) that cause the failing merge, and perhaps run the whole thing under strace
or similar to observe the failing system call. 由于
fetch
成功,您可以检查导致失败合并的提交,并且可能在strace
或类似情况下运行整个事件以观察失败的系统调用。
(The split into fetch+merge is not required, you can strace a pull, it's just that it should help reduce the amount of irrelevant crud to comb through.) (分割成fetch + merge不是必需的,你可以拉一个拉,它只是它应该有助于减少不相关的crud数量。)
[Edit: and, once again SO has resurrected an old question... gotta start looking at the timestamps on these! [编辑:并且,再一次SO已经复活了一个老问题......要开始查看这些时间戳! And, noting the OSX tag, make that
dtruss
instead of strace.] 而且,注意OSX标签,使得
dtruss
而不是strace。
I had the same problem but in my case I hadn't time to check how it would be happen. 我有同样的问题,但在我的情况下,我没有时间检查它会如何发生。 I resolved it by use command below - may be will be helpful for someone:
我通过下面的使用命令解决了它 - 可能会对某人有所帮助:
git config core.symlinks false
However, I don't know how this works for whole project, so you can use it for only your responsibility. 但是,我不知道这对整个项目有何影响,因此您只能将其用于自己的责任。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.