Reputation: 100153
I've got a repo that is only accessible via git: from some machines, and only accessible from https: from others, and I want to set up a submodule that references it. Can I set up a 'proxy' that just maps from one to the other?
Upvotes: 0
Views: 105
Reputation: 2165
A submodule URL can be relative to its superproject. Depending on how the repositories are going to be hosted, this can be used instead of recording full submodule URLs. From the git submodule add
documentation:
<repository> is the URL of the new submodule’s origin repository. This may be either an absolute URL, or (if it begins with ./ or ../), the location relative to the superproject’s default remote repository (Please note that to specify a repository foo.git which is located right next to a superproject bar.git, you’ll have to use ../foo.git instead of ./foo.git - as one might expect when following the rules for relative URLs - because the evaluation of relative URLs in Git is identical to that of relative directories).
When the submodule is added to the superproject it will record that relative URL instead of the full one. When someone then clones recursively, the submodule will be cloned from the same base URL. In your case, people cloning the superproject with git:
URLs will also use git:
URLs for the submodule, people cloning with https:
URLs will also use https:
URLs for the submodule.
Upvotes: 0
Reputation: 1372
My suggestion is not to use the proxy setting, use the insteadof config setting:
[url "[email protected]"]
insteadOf = https://theother.git.url.com/
You can set this per user, in ~/.gitconfig
, or per system, usually /etc/gitconfig
Upvotes: 2