Git
symbolic links
Windows
symlinks
version control

Git symlinks on Windows: core.symlinks, mklink and Developer Mode

Codemia Knowledge Hub ·

Git records a symbolic link as a special entry (mode 120000) whose content is the target path, but whether it checks out as a real link on Windows depends on the filesystem, the user's privileges and the core.symlinks setting. The same committed symlink can appear as a real link on one Windows machine and as a plain text file containing the target path on another. Enabling Developer Mode and setting core.symlinks to true usually makes it work.

Git does not store a copy of the target file. It stores:

  • a special file mode for symlink entries
  • the target path as the blob contents

Unix-like systems recreate the symlink on checkout. On Windows, it depends on whether the environment can actually create symlinks.

Windows supports symbolic links, but creating them historically required elevated privileges. On newer systems, Developer Mode makes it easier for normal development work. The deciding factors are:

  • NTFS filesystem support
  • whether the user can create symlinks
  • whether Git believes symlinks are supported in that working tree

If these are not met, Git may fall back to a regular file that contains the link target as plain text.

Git uses core.symlinks to decide whether to check out symlinks as real symlinks. Check the current value:

bash
git config --get core.symlinks

Enable it for the repository if the machine supports symlinks:

bash
git config core.symlinks true

This matters most when the repository is created or cloned on Windows, because Git probes the filesystem's capability at that point and may set the behavior accordingly.

From Command Prompt, create a file symlink with mklink:

bat
mklink link.txt target.txt

For directories:

bat
mklink /D linkdir targetdir

If symlink support is active, Git then sees a symlink entry:

bash
git add link.txt
git commit -m "Add symlink"

If core.symlinks is disabled or the OS refuses to create the link, the result behaves differently.

Developer Mode

On modern Windows, enabling Developer Mode is often the easiest way to make symlinks usable without running every shell as Administrator. With it on, Git Bash, Command Prompt and PowerShell are much more likely to create and check out symlinks under normal user accounts. Without it, the repository may contain symlinks that the local checkout does not reproduce.

Cross-platform repositories

A repository shared across macOS, Linux and Windows can use symlinks, but only if Windows contributors have working symlink support. Otherwise they may see broken builds or odd text files where links were expected, so document the Windows prerequisites clearly.

To check how Git recorded an entry:

bash
git ls-files -s

A symlink typically shows mode 120000, which confirms Git recorded it as a link in the index.

Avoiding symlinks can be the better choice when:

  • contributors have locked-down corporate machines
  • build tools do not handle symlinks consistently
  • the repository is consumed by software that expects normal files only

Duplication, generated files or a different project layout may then be more reliable.

  • Symlink support is not purely a Git feature. On Windows, the OS and permissions matter just as much.
  • If core.symlinks is disabled, checkout can look wrong even when the repository stores the symlink correctly.
  • A Windows shortcut is not a symlink, and Git does not treat it as one.
  • A symlink that works on one teammate's machine may not work on another, because Developer Mode, privileges and filesystem configuration differ.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Interview Questions practice on Codemia

Over 11,000 interview practice questions for 300+ companies, searchable by company and role.

Browse interview questions