13

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.

3
  • 2
    i don't know for sure, but i somewhat doubt git understands windows links, being written by the linux kernel's author for use with the linux kernel and all. even putting unix symlinks in git isn't the greatest idea. Commented Nov 7, 2013 at 22:07
  • @Eevee - I suspect the same as well. However, there is about 80 -90mb content in this symlinked folder. I do not wish to have that committed to the repo and downloaded everytime for a CI build. The firm has a CI standard where a fresh sync is done for every build and that standard cannot be altered :( Commented Nov 8, 2013 at 16:52
  • Creating symlinks on Windows still doesn't work natively, even as of Git for Windows v2.3.6.. Commented Apr 27, 2015 at 8:18

1 Answer 1

6

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
Sign up to request clarification or add additional context in comments.

6 Comments

This doesnt work for me, not sure if i am missing something. From the example I see that they are usign a link for a directory within the structure. However, my usecase is to create a symlink for a folder in a network share. bla -> \\server\foo\
@praskris can't you subst that network path, associating it to a drive letter?
unfortunately I cannot as the code is synced to different agents and directories during continuous integration builds and subst (ing) the folder into the specific location in the structure will not be possible. Moreover, we might not have the permission to do that int he build agent machine.
@praskris then the question isn't really about git and symlinks, but more about Windows symlinks and UNC path, isn't it?
@VonC- I am not sure I understand. I am able to create a symlink to a UNC path in windows. Thr problem is with committing it to Git. It picks it up as a normal folder and adds all the files under the symlinked folder too
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.