I"m still trying to figure my way out around Git submodules. Let's say I'm using submodules pointing to a public repository to which I only have read access.
What happens to my project when that repository is taken offline and is no longer accessible?
That's one of the beauties of git/DSCM: your local clone is a complete standing repository. Submodules are no exception.
Any "central" repository is simply a location where developers of a project
agree to push changes to. Write access in simplest terms means that you get to push to this pre-agreed upon location. Theoretically you could even network multiple "central" repo hosts and have developers push to each one, or have each repo run hooks to sync with each other.
Because every clone of a git repository (including submodules) is a complete repo by itself, if that central official push location gets changed, or disappears you still have a completely working repository with full read/write access to your local clone.
In the case that the official submodule project developers decide that they simply wanted to relocate their "central" clone, all you have to do is update your submodule's remotes to point to the new, correct location.
GitHug: Adding a remote
GitBook: Remote Branches
GitBook: working with Remotes
Suppose that your project can be accessed by other people. This implicitly means that these user would also need access to any submodules your project uses.
You could re-host your local submodules (known as "forks") and modify your main project repo to refer to the forked repos. This is preferred over copy/paste, and may be a good idea even if the official repo is still around. This is dependent upon the license the original project was provided under, of course.
Few reasons why this is a good idea:
In a way submodules are are viewed as separate repositories. So if your submodule repo goes offline - there is no way to update a submodule.
When you use a submodule you imply that the repo is accessible to all the developers throughout dev cycle.
Only use submodules for relatively stable components.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With