GIT can't pull: failed to symlink 'path/filename': File name too long

隐身守侯 提交于 2019-12-05 12:32:51

The only place where I see a failed to symlink is in the merge-recursive.c file:

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.
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. Presumably (as @VonC noted) the error will only happen with git merge (which makes sense since pull is just fetch-then-merge here). 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.

(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.)

[Edit: and, once again SO has resurrected an old question... gotta start looking at the timestamps on these! And, noting the OSX tag, make that dtruss instead of 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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!