in git bash in windows ln -s /destinations/path/ link_name just copies the destination rather than creates a link
Asked Answered
H

2

13

In Git bash i have run the following:

ln -s "//server/path/Resource/" test

When I check if it's worked:

ls -l

It appears as a folder rather than a symlink. I am using windows and trying to create a symbolic link to a network location. This is probably an easy fix but i just want a shortcut rather than copying a massive folder.

Heidt answered 12/12, 2018 at 16:6 Comment(1)
There's some explanation & workarounds here: superuser.com/questions/550732/use-mklink-in-msysCristobalcristobalite
L
0

make sure your git config points symbolic links as true.

core.symlinks=false

make this as true as by default it is

Lasso answered 25/9, 2019 at 3:57 Comment(1)
That's not sufficient. I have symlinks=true in the [core] section of C:\ProgramData\Git\config, and ln still copies instead of creating a symlink.Kalisz
A
0
  • First, enable symlinks for your user:

If you have Windows 10, and turn on Developer Mode, it's enough. If you're running a server, you'll need to gpedit, and then set this:

Computer configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment and edit the Create symbolic links

  • Next do these two:
git config --global core.symlinks true
export MSYS=winsymlinks:nativestrict  # or add to env/bashrc!
  • You may have to open this:
vi /c/Program\ Files/Git/etc/gitconfig

And add this:

[core]
    symlinks = true

YMMV, I didn't need this on a newer version, the global config set was enough. Depends.

After that ln -s works as you might expect.

Absolutely answered 3/7 at 0:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.