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. Further, path/to/filename
isn't even the longest path.
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 :
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.