Is it possible to provide both https and ssh access to a git submodule?
Some people might prefer to use https and some might only be able to use ssh (e.g. because they are behind an ssh tunnel).
Is it possible to provide both options of fetching submodules?
Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.
Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.
If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.
You can use relative URL when referencing a submodule.
For example if you have an application repository:
[email protected]:project/app.git
http://example.org/git/project/app.git
and a library repository:
[email protected]:lib/some-library.git
http://example.org/git/lib/some-library.git
,then you can reference the library as ../lib/some-library.git
instead of the full URL.
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