问题
I would like to set up a public GitHub repo with submodules. GitHub offers two ways of connecting - https:... & git@... protocols. For the team working on the project, git@... is much easier to use because we all use proper ssh certificates. But for the casual user who is not a member of the team, https:... is the only option. The git submodules require a full URL.
How can we set up repository submodules so that both the developers and casual contributors can use the system equally well? Thanks!
回答1:
Publish your submodules with https:// protocol but make all your developers to use ssh:// protocol. Git can substitute one protocol with the other on the fly:
git config url."ssh://git@".insteadOf https://
回答2:
First, it is not the "git protocol", but actually the SSH one, with URL like git@github.com:user:repo.
(there actually is a git protocol, no longer used these days)
Second, keep the URLs as https for the submodules: it is easy to cache the credentials (username/password) with a credential manager (like GCM for Windows).
But that means those users need to be added as contributors (whether or not you are using HTTPS, or SSH URLs)
来源:https://stackoverflow.com/questions/50282837/using-ssh-vs-https-with-github-submodules