Using ssh vs https with github submodules

孤人 提交于 2020-01-13 19:15:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!