If you want to clone a git repository with submodules for use exclusively within Cygwin, you can. Take pymode, a Vim plugin, as an example. You can, from within Cygwin, perform git clone described in their documentation without issue.
cd ~/.vim/pack/python-mode/start
git clone --recurse-submodules https://github.com/python-mode/python-mode.git
cd python-mode
From there, you can start using the Cygwin version of Vim to enjoy the plugin without issue.
But if you wanted to clone the repository for use with a Windows-only, no-cygwin program - such as the Windows version of Vim - then you will run into an incompatibility between Cygwin-style symlinks and native Windows programs. In short - they're not compatible. Native Windows applications don't know how to handle the Cygwin symlinks. But they shouldn't be expected to!
Fortunately, Cygwin has the ability to use Windows native symlinks on the versions of Windows that support it. (Vista and higher) All you have to do is, from within your Administrator-privileged Cygwin session, export CYGWIN=winsymlinks:nativestrict
. This will force Cygwin to use native Windows symlinks. (If it can't, for whatever reason, then the attempt to create the link will fail.)
In addition to telling Cygwin to create symlinks, you will also have to tell git to create symlinks with -c core.symlinks=true
, replacing the git clone line above with the following:
git clone --recurse-submodules https://github.com/python-mode/python-mode -c core.symlinks=true
So far so good. So you run your clone... and it fails!
$ git clone --recurse-submodules https://github.com/python-mode/python-mode.git -c core.symlinks=true
Cloning into 'python-mode'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 8044 (delta 14), reused 32 (delta 12), pack-reused 8002
Receiving objects: 100% (8044/8044), 10.67 MiB | 3.39 MiB/s, done.
Resolving deltas: 100% (3234/3234), done.
error: unable to create symlink pymode/autopep8.py: No such file or directory
error: unable to create symlink pymode/libs/astroid: No such file or directory
error: unable to create symlink pymode/libs/logilab: No such file or directory
error: unable to create symlink pymode/libs/mccabe.py: No such file or directory
error: unable to create symlink pymode/libs/pycodestyle.py: No such file or directory
error: unable to create symlink pymode/libs/pydocstyle: No such file or directory
error: unable to create symlink pymode/libs/pyflakes: No such file or directory
error: unable to create symlink pymode/libs/pylama: No such file or directory
error: unable to create symlink pymode/libs/pylint: No such file or directory
error: unable to create symlink pymode/libs/rope: No such file or directory
error: unable to create symlink pymode/libs/six.py: No such file or directory
error: unable to create symlink pymode/libs/snowballstemmer: No such file or directory
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
Why does it do that?