Git submodule for Linux and Windows
git, git-submodules
Solution
No. Submodules are generally designed for one repository URL that works everywhere, usually network-based (e.g. `git://host/path`). There is no mechanism for providing multiple different URLs for one repository.
That said, Git does allow you to customize a submodule's URL. When submodules are initialized (`git submodule init`), the URL from `.gitmodules` is copied to your `.git/config` file. You can now edit the URLs there before running `git submodule update`.
Problem
When using `git submodule` on Linux I might have a `.gitmodules` with one or more subsystems checked out from e.g. `/mnt/gitrepos/subsystem1.git` (central file based access). ``` [submodule "subsystem1"] path = subsystem11 url = /mnt/gitrepos/subsystem1.git/ ``` I would like to support also a Windows user who can access the same module repo from `H:/gitrepos/subsystem1.git/`. It is e.g. a Samba share from Linux of `/mnt/gitrepos/` as the share `gitrepos`. Is there a way where Git can handle the URL line depending on the OS? For Windows the `.gitmodules` would be ``` [submodule "subsystem1"] path = subsystem11 url = H:/gitrepos/subsystem1.git/ ``` Thus I would like "something like" this generic code for `.gitmodules` (speculative syntax): ``` [submodule "subsystem1"] path = subsystem11 if Linux url = /mnt/gitrepos/subsystem1.git/ else url = H:/gitrepos/subsystem1.git/ ```