However, this works only if the repo of the submodule belongs to the same user as the main repo.
EDIT:
Log:
EXCEPTION in Job 'DownloadRepoJob' @ 9/27/2022 3:51:44 PM LibGit2Sharp.RecurseSubmodulesException: The top level repository was cloned, but there was an error cloning its submodules.
---> LibGit2Sharp.LibGit2SharpException: unsupported URL protocol
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_submodule_update(SubmoduleHandle submodule, Boolean init, GitSubmoduleUpdateOptions& options)
at LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
at LibGit2Sharp.Repository.RecursivelyCloneSubmodules(CloneOptions options, String repoPath, Int32 recursionDepth)
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
--- End of inner exception stack trace ---
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
Reproduction steps
Create repository and add a project to it.
Repository should have the following structure.
Add a submodule with a destination
git submodule add git@github.com:username/Some-Repo.git submodules/some-repo/
The repo structure should look like
and the contents of .gitmodules is
Expected behavior
Cloned repository + submodules
Actual behavior
The top level repository was cloned, but there was an error cloning its submodules.
Probably related: https://github.com/libgit2/libgit2sharp/issues/1115 Supposidely fixed with https://github.com/libgit2/libgit2/pull/3500
The current workaround is to rewrite the path in .gitmodules to a relative one (as in the PR from 2015) with a leading "../". Eg.
However, this works only if the repo of the submodule belongs to the same user as the main repo.
EDIT: Log: