There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone a repository with symlinks on Windows?
Since version 1.5.3 of the native Git client
git clone and
git init will probe the target file system for symlink support and set the local repository configuration for
core.symlinks accordingly, i.e. to
false for FAT or NTFS. This makes e.g. symlinks created under Linux to be created as plain text files that contain the link text under Windows (see the git config documentation on core.symlinks for details).
Since Git for Windows version 2.10.2 the installer has an explicit option to enable symbolic link support.
In older versions of Git for Windows you can manually set
true which enabled Git to create symbolic links under the following constraints:
More details are available in the Git for Windows wiki.
In older versions of Git for Windows manually setting
core.symlinks manually to
true after cloning and reset your working tree, you would get error messages similar to
$ git reset --hard HEAD error: unable to create symlink directory (Function not implemented) error: unable to create symlink linux-links/this_is_a_symbolic_link_to_file (Function not implemented) fatal: Could not reset index file to revision 'HEAD'.
As a side note, the JGit client did not probe the target file system for symlink support until its version 3.3, so the
core.symlinks setting was falling back to whatever the system / global Git configuration was. Starting with version 3.3 JGit probes for symlink support but seems to be too conservative, setting
core.symlinks = false in some cases where symlinks would be in fact supported.
You can checkout https://github.com/sschuberth/sandbox which contains a bunch of links created on Linux for testing.