Git Symlinks in Windows

前端 未结 13 1456
执念已碎
执念已碎 2020-11-22 09:23

Our developers use a mix of Windows and Unix based OS\'s. Therefore, symlinks created on Unix machines become a problem for Windows developers. In windows (msysgit), the sym

13条回答
  •  长发绾君心
    2020-11-22 09:24

    so as things have changed with GIT since alot of these answers were posted here is the correct instructions to get symlinks working correctly in windows as of

    AUGUST 2018


    1. Make sure git is installed with symlink support

    2. Tell Bash to create hardlinks instead of symlinks

    EDIT -- (git folder)/etc/bash.bashrc

    ADD TO BOTTOM - MSYS=winsymlinks:nativestrict

    3. Set git config to use symlinks

    git config core.symlinks true
    

    or

    git clone -c core.symlinks=true 
    

    NOTE: I have tried adding this to the global git config and at the moment it is not working for me so I recommend adding this to each repo...

    4. pull the repo

    NOTE: Unless you have enabled developer mode in the latest version of Windows 10, you need to run bash as administrator to create symlinks

    5. Reset all Symlinks (optional) If you have an existing repo, or are using submodules you may find that the symlinks are not being created correctly so to refresh all the symlinks in the repo you can run these commands.

    find -type l -delete
    git reset --hard
    

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

提交回复
热议问题