-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Symbolic Links
Short version: there is no exact equivalent for POSIX symlinks on Windows, and the closest thing is unavailable for non-admins by default. Therefore, symlink emulation support is switched off by default and needs to be configured by you, the user, via the core.symlinks=true config setting.
Starting with Windows Vista, there is support for symbolic links. These are not your grandfather's Unix symbolic links; They differ in quite a couple of ways:
- Symbolic links are only available on Windows Vista and later, most notably not on XP
- You need the
SeCreateSymbolicLinkPrivilegeprivilege, which is by default assigned only to Administrators but can be assigned to normal users using Local Security Policy (or via Active Directory). Home Editions of Windows Vista and Windows 7 do not have Local Security Policy, but the freely available Polsedit (http://www.southsoftware.com) can be used on these editions. Note that regardless of privilege assignment, members of the Administrators group will also require UAC elevation (see the full details in Access Token Changes just above https://msdn.microsoft.com/en-us/library/bb530410.aspx#vistauac_topic4) - Symbolic links on remote filesystems are disabled by default (call
fsutil behavior query SymlinkEvaluationto find out) - Symlinks on Windows are always absolute, which does not make much sense in Git’s context: if you version-control symlinks, they typically need to point back into the same working tree, i.e. they are relative. The way we handle this in Git for Windows means that you cannot blindly copy/move your code and expect it to work properly, if it contains symlinks.
- Symbolic links will only work on NTFS, not on FAT
- Windows' symbolic links are typed: they need to know whether they point to a directory or to a file (for this reason, Git will update the type when it finds that it is wrong)
- Many programs do not understand symbolic links
For those reasons, Git for Windows disables support for symbolic links by default (it will still read them when it encounters them). You can enable support via the core.symlinks config variable, e.g. when cloning:
git clone -c core.symlinks=true <URL>By default, the ln -s command in Git Bash does not create symbolic links. Instead, it creates copies.
To create symbolic links (provided your account has permission to do so), use the mklink.exe tool, like so:
mklink /d this-link-points-to c:\that-directory
mklink this-link-points-to c:\that-fileThis wiki page has been retired. All it did was to point to Git for Windows' governance model.