While developing some patches on projects with an upstream Git repository I’m currently doing the following.
superproject/submodules/actualproject
^ parent repo ^ Git submodule
actualproject has two remotes:
vendorbeing the “upstream” remote.mynamebeing my own “internal” remote repository.
Works fine this way, but as soon as another person (colleague) clones my tree (either using the superproject via submodules or just one of the submodules on its own), he’ll have:
- remote
originbeing my repository. - remote
vendorisn’t present.
What’s the best way to have at least the vendor remote configured automatically for the others cloning? Can I use the powers of submodules here? Eg. submodule init already sets a remote – can I set a second?
Or, is this a completely wrong approach from the beginning?
Your colleague should
git clone <URL to 'vendor' repo>instead of using your own repo. That way he’ll get that remote (it’ll be called “origin” at first because that’s a git default, but he could change it if he wanted to).Edit: To change the submodule remote he gets when he clones the super-project, you’ll have to edit your .gitmodules file to point to ‘vendor’ instead of ‘myname’ 😉