How do i commit a windows symlink into Git

praskris picture praskris · Nov 7, 2013 · Viewed 8.9k times · Source

I have added a windows (window 7) symlink to my codebase ("foo" -> \\server\foo). I have a large set of configuration files under the networks share -\server\foo location. How do i check-in this symlink "foo" into my Git repo?

Any other user cloning the repo should get this link and should be able to pick up the files from the \\server\foo\ location.

The thought is to avoid repeated syncs of this large set of config files during integration builds

When i tried checking in, all the files under the \\server\foo location. When a user cloned the repo, "foo" was added as a simple directory.

Answer

VonC picture VonC · Nov 8, 2013

You need to create the right entries (special filemode 120000) in the index in order to encode, and then decode symlinks in Windows.

See "Git Symlinks in Windows", espcially the aliases

  • git add-symlink
  • git checkout-symlinks