简体   繁体   English

Git子模块最佳实践 - 总是在https上使用ssh协议?

[英]Git submodules best practice - always use ssh protocol over https?

I work on a lot of projects that use submodules, and some of them are added to their parent repos using a combination of both the https and ssh protocols , as if it's not important which one. 我在很多使用子模块的项目上工作,其中一些项目使用https和ssh协议的组合添加到它们的父目录中,就好像哪个不重要。 SSH protocol has benefits that it uses ssh keys, but requires users set up those keys first . SSH协议具有使用ssh密钥的优点,但需要用户首先设置这些密钥

I'd like to make a team policy: all projects should use GitHub's git user with ssh protocol in submodules. 我想制定团队策略:所有项目都应该在子模块中使用GitHub的git用户和ssh协议 What are the pros/cons of said policy? 该政策的利弊是什么?

Pro: 优点:

  • ssh keys can be registered/revoked ssh密钥可以注册/撤销

Cons: 缺点:

I prefer activating 2FA on GitHub account , and use only Personal Access Token, which can be revoked as well, but which are used as classic username/password way ( and which can be cached ) with https url . 我更喜欢在GitHub帐户上激活2FA ,并且只使用个人访问令牌,也可以撤销,但可以使用https url作为经典的用户名/密码方式( 可以缓存 )。

In both cases, the user need to be added as a collaborator to the GitHub repo . 在这两种情况下, 用户都需要作为协作者添加到GitHub仓库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM