TaxiMike
TaxiMike

Reputation: 229

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

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.

Upvotes: 15

Views: 2540

Answers (2)

Erik Aronesty
Erik Aronesty

Reputation: 12915

  • 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.

Upvotes: 4

user2636464
user2636464

Reputation: 735

make sure your git config points symbolic links as true.

core.symlinks=false

make this as true as by default it is

Upvotes: 0

Related Questions