git bash symbolic links on windows

I did an ln -s file1 file2  in gitbash.

when I did an ls -l file2 it did not have an “s” in it.

When I did “stat” on each file, there were different inodes.

I was wondering whether “ln -s” (symbolic links) do not work on git bash in Windows 7?

1 Like

Hi @bistritapcv,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the How to use Git and GitHub board. No action is needed on your part; you can continue the conversation as normal here.

Let me know if you have any other questions or if I can help with anything else.

Cheers!

Unfortunately, no one has answered.

1 Like

Symbolic links on Git Bash for Windows needs to be enabled when you install it

9 Likes

how to get it enabled after its installed

1 Like

I would just reinstall gitbash, quick and easy!

1 Like

You can set this in the config file for git for windows. By default, this is located at C:\ProgramData\Git\config.  

Find the [core] section and add symlinks = true to turn it on. 

8 Likes

Hm, I have symlinks=true, but ln -s largeFolder shortcut just starts to make full copy… 

$ cat /c/ProgramData/Git/config
[core]
symlinks = true

$ echo Orig > 1
$ ln -s 1 2
$ cat 2
Orig
$ echo Modified > 2
$ head 1 2
==> 1 <==
Orig
==> 2 <==
Modified
4 Likes

This answer worked for me:
https://stackoverflow.com/a/40914277/3990615

4 Likes

That did it!

  1. run as admin

  2. export MSYS=winsymlinks:nativestrict

4 Likes

If you enable “Developer mode” in the Windows 10 settings you don’t have to run the shell as Admin.

That is, run Git Bash as admin, run the command export MSYS=winsymlinks:nativestrict, then run ln -s oldFile newLink to your hearts content within that session.

1 Like