When adding to the index a symlink to a directory, I get the following error message:
fatal: pathspec 'XXX' did not match any files
The file is there, and it is indeed a symlink, even to a directory inside the repository in fact.
Note that even after committing and pushing into Git, the symlinks still work fine. However, after some branch switches and code merges, the symlinks become actual text files with the link target as the contents.
A symbolic link, also known as a soft link or symlink, is a special file pointing to another file or directory using an absolute or relative path. Symbolic links are similar to shortcuts in Windows and are useful when you need quick access to files or folders with long paths.
Git just stores the contents of the link (i.e. the aforementioned path of the file system object that it links to) in a 'blob' just like it would for any other file. It then stores the name, mode and type (including the fact that it is a symlink) in the tree object that represents its containing directory.
Go to the folder where you want the symlink to appear, right-click it, then select “Drop As -> Symbolic Link.”
At least on my machine (Mac OS 10.7), the solution was to have the symlink actually point to some real content. In other words, the way the symlink was setup in the repository was that it was 'broken' (this was intentional: during the build process, that symlink would eventually become active in the final product). So I created a directory where the symlink was expecting it, was able to commit without an error, and then could delete that directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With