GIT cannot pull: failed to specify path / file name link: file name is too long

Feeling stupid, but I can't figure out what to do here.

I have a local copy of the repository stored on a remote server. The remote server has the changes I need, and I made changes to my local copy. I cannot click because I need to combine the changes with a newer version existing 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 will be here. The crazy thing is that the path/to/filename file is the actual file, not a symbolic link. In addition, path/to/filename not even the longest path.

It is actually unclear where to start debugging this problem.

+4
source share
3 answers

The only place I see an inconsistent link 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 extracting from contains filename as a symlink, while the local repo contains the same filename as a regular file.
This could be causing a fatal error message.

0
source

I would start debugging starting with git fetch , and only after that I can switch to 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 fetch will succeed, you can check the commit (s) that cause the crash and possibly run everything in strace or similarly watch for a system call crash.

(Sampling + merging is not required, you can stretch the traction just so that it helps reduce the amount of irrelevant crud to comb through.)

[Edit: SO again resurrected the old question ... you need to start looking at the timestamps on them! And, by dtruss OSX tag, do dtruss instead of strace.]

0
source

I had the same problem, but in my case I did not have time to check how this would happen. I resolved it using the command below - maybe it will be useful for someone:

 git config core.symlinks false 

However, I do not know how this works for the whole project, so you can use it only for your responsibility.

0
source

Source: https://habr.com/ru/post/1436261/


All Articles