Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git cannot create Windows native symlinks #27

Open
ghost opened this issue Mar 10, 2017 · 5 comments
Open

Git cannot create Windows native symlinks #27

ghost opened this issue Mar 10, 2017 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Mar 10, 2017

Cygwin can easily create Windows native symlinks:

touch alfa.txt
CYGWIN=winsymlinks:native ln -s alfa.txt bravo.txt

However Cygwin Git seems to have no way to create Windows native symlinks:

CYGWIN=winsymlinks:lnk git clone git://github.com/stedolan/jq

creates README as a Shortcut (.lnk) file.

CYGWIN=winsymlinks:native git clone git://github.com/stedolan/jq

creates README as a Cygwin symlink, not a Windows native symlink.

CYGWIN=winsymlinks:nativestrict git clone git://github.com/stedolan/jq

just creates a plain text file, not even a symlink:

$ cat jq/README
README.md

http://cygwin.com/ml/cygwin/2017-03/msg00110.html

@ghost
Copy link
Author

ghost commented Apr 15, 2017

@me-and any comment? I am also requesting new version:

http://cygwin.com/ml/cygwin/2017-04/msg00193.html

@me-and
Copy link
Member

me-and commented Apr 19, 2017

(I really need to get GitHub notifications working in a more reliable fashion; notifications about things I actually care about like this are far too often getting lost in the noise.)

It looks to me like the problem is Cygwin failing to create native symlinks. If you look at the CYGWIN environment variable documentation, if creating a symlink using winsymlinks:native fails, it'll fall back to creating Cygwin default symlinks, whereas if winsymlinks:nativestrict is set, it will fail to create the symlink entirely, which results in Git's default behaviour in environments without symlinks, i.e. setting core.symlinks to false and just recording the symlink destination in the file text.

Interestingly, I get the same behaviour with ln -s in Cygwin Bash on my current machine unless I'm running with Administrator privileges.

The next question, then, is working out why running ln -s from an elevated Cygwin Bash shell works, but the equivalent within Git doesn't. Next step there, I think, will be digging through strace output from a Git command that ought to create a Windows native symlink.

@me-and me-and added the bug label Apr 19, 2017
@douglaswth
Copy link

I just ran into this and noticed that if I delete a symlink and then use git checkout -f to restore it, it does come back as a Windows native symlink unlike the behavior from git clone.

@ieglandDRS
Copy link

This issue is causing lots of headaches for me over here.

@ieglandDRS
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants