maphew

Git: enable symlinks

For users who have Developer Mode enabled, the mklink command will now successfully create a symlink if the user is not running as an administrator.

 

From < https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/#oTepts0M8148xRoj.97

  • edit policy, add your user on Local Comp Policy > Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment > Create symbolic links
  • enable Windows Developer mode to bypass UAC requirement
    • Search > For developer settings > Dev mode 

(use the single slider and text saying "enable installing apps from any source" )

From < https://gist.github.com/huenisys/1efb64e57c37cfab7054c65702588fce#file-enable-symbolic-links-for-git-on-windows-10-md

--> see Windows symlink without elevation for cmd line enable developer mode 

So as things have changed with Git since a lot of these answers were posted, here is the correct instructions to get symbolic links working correctly in Windows as of:

August 2018 

1. Make sure Git is installed with symbolic link support 

Article Image

2. Tell Bash to create hardlinks instead of symbolic links 

(git folder)/etc/bash.bashrc

Add to bottom - MSYS=winsymlinks:nativestrict

3. Set Git config to use symbolic links 

git config core.symlinks true

or 

git clone -c core.symlinks=true <URL>

Note: I have tried adding this to the global Git configuration and at the moment it is not working for me, so I recommend adding this to each repository ...

4. pull the repository 

Note: Unless you have enabled developer mode in the latest version of Windows 10, you need to run Bash as administrator to create symbolic links

5. Reset all symbolic links (optional)

If you have an existing repository, or are using submodules you may find that the symbolic links are not being created correctly so to refresh all the symbolic links in the repository you can run these commands.

find -type l -delete 
git reset --hard

Note: this will reset any changes since the last commit, so make sure you have committed first

 

From < https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows/59761201#59761201