Skip to content

Windows git does not checkout symlinks, even if SeCreateSymbolicLinkPrivilege is enabled #5805

@gisburn

Description

@gisburn

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

$ '/cygdrive/c/Program Files/Git/cmd/git' --version
git version 2.49.1.windows.1

Windows version

Windows 10

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

$ cmd.exe /C 'ver'
Microsoft Windows [Version 10.0.19045.6282]

Options set during installation

-

Other interesting things

No response

Terminal/shell

Commands that trigger the issue

Testcase:
(Note that the testcase is run from Cygwin, but the checkout is done using Windows git. We do that so the symlink is correctly stored in the git repro, and Windows git is only used for clone/checkout to demonstrate the bug.)
---- snip ----
set -o xtrace
set -o errexit

rm -Rf newgitproj newgitproj_cloned

#
# Create via Cygwin git
#
mkdir newgitproj
cd newgitproj
git init --initial-branch='master'
git config --global --add safe.directory "$PWD"
git config --global --add safe.directory "$PWD/.git"
 
printf 'Hello, Git symlink test!\n' >'README.md'
git add 'README.md'
git commit -m 'Add README file'

ln -s 'README.md' 'README_link.md'
git add 'README_link.md'
git commit -m 'Add symlink to README file'
cd ..

#
# clone via Windows git
#
'/cygdrive/c/Program Files/Git/cmd/git' clone newgitproj newgitproj_cloned
cd newgitproj_cloned
if [[ ! -L 'README_link.md' ]] ; then
	printf '## Test failed\n'
	exit 1
fi

printf '## Test OK\n'
exit 0
# EOF.
---- snip ----

Expected behaviour

'/cygdrive/c/Program Files/Git/cmd/git' clone newgitproj newgitproj_cloned should checkout the symlonk correctly, OR bail out with an ERROR if it cannot create a symlink

Actual behaviour

It creates a plain file, which is not a symlink. UNIX (Solaris, Linux) and Cygwin (POSIX layer on top of Win32) do this correctly

Repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions