简体   繁体   English

GIT无法拉取:未能符号链接'path / filename':文件名太长

[英]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.

相关问题 Git OS X 上的“文件名太长”错误 - Git 'filename too long' error on OS X GIT / RubyMine(Leopard)-无法拉出,但我可以提交并推入 - GIT / RubyMine (Leopard) - can't pull but I can commit and push 我可以在git中修改名称与操作系统相关的路径 - Can I version a path in git whose name is operating system dependent 为什么在OSX的$ PATH中找不到应用程序中的符号链接? - Why isn't symlink in application being found in $PATH in OSX? OS X - 无法启动 Git:/usr/bin/git 可能 Git 可执行文件的路径无效 - OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid 无法配置 git,缺少 .gitconfig 文件 - Can't configure git, missing .gitconfig file 将文件移动到文件名中带有路径分隔符“ /”的文件 - moving File leads to file with path separator “/” in filename Hg Git Pull 导致打开文件过多错误 - Hg Git Pull Causes Too Many Open Files Error 从git中删除已删除的文件:参数列表过长 - remove deleted files from git: Argument list too long INTELLIJ IDEA 错误:“无法启动 Git:/usr/bin/git 可能 Git 可执行文件的路径无效。修复它。” 如何修复? - INTELLIJ IDEA ERROR: "Can't start Git: /usr/bin/git Probably the path to Git executable is not valid. Fix it." How to Fix it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM