I use git (TortoiseGit 1.7.5.0) and have a repo with submodules, which are referenced via absolute paths in a manner:
[submodule "common/sub"]
path = common/sub
url = ssh://localhost/lib/common/sub
While the super-repo is cloned as ssh://user@localhost/super
, the username shouldn't go into each submodule url, because different users should work with the code using their own credentials.
When pulling/pushing submodules I had to enter my login (the password is not needed because I'm running Pageant): the username isn't passed to TortoisePlink via command line.
Surfing the Web, I found several posts mentioning relative urls for submodules, but apparently such approach doesn't work well with TortoiseGit: I tried several formats - the program often crashes. Anyway I succeeded with the format like:
[submodule "common/sub"]
path = common/sub
url = ../common/sub
The file .git/config
is populated with the proper absolute urls, but after that TortoiseGit just crashes...
I've reviewed other options including:
use gitolite (as proposed here) or sdorra (as proposed here), but this looks like an overcomplicated solution.
follow subtree merge strategy (as proposed here). It looks like a nice approach.
One of the working workarounds is to initialize the submodule with a "non-standard" URL as explained at the end of git Submodules Explained (the link was found here).
I suppose some simpler workaround may help in my case (like providing default login in some local config file or via command line), but I haven't found any workable hints for that.
And the question: what is the easiest way of using submodules without hard-coded user names in absolute urls?