简体   繁体   English

通过HTTPS或SSH使用Git的最佳方法是什么?

[英]What is the best way to use Git, with HTTPS or with SSH?

I was wondering what is the safest way to use services like Github and Bitbucket. 我想知道使用Github和Bitbucket等服务的最安全方法是什么。 What are the differences between use HTTPS and use SSH? 使用HTTPS和使用SSH有什么区别?

Will it change how the repositories are invoked? 它会改变存储库的调用方式吗? I meant, I have seen commands like: 我的意思是,我已经看过以下命令:

git clone git@github.com:nsf/godit.git

and

git clone https://github.com/nsf/godit.git

I'd like avoid problems like this: 我想避免这样的问题:

Troubleshooting git push - it asks for a user/pass 对git push进行故障排除-它要求用户/密码

The differences are mainly in the way authentication is done: for SSH, you'll use the keys to authenticate, and HTTPS will use username/password. 区别主要在于身份验证的完成方式:对于SSH,您将使用密钥进行身份验证,而HTTPS将使用用户名/密码。

Note that to use SSH, you'll need to have write access to a repository, whereas HTTPS can be used for any type of a repository. 请注意,要使用SSH,您需要对存储库具有写权限,而HTTPS可以用于任何类型的存储库。 Here 'sa useful help page with more details. 是一个有用的帮助页面,其中包含更多详细信息。

To avoid having to re-enter the password with HTTPS authentication, see this article . 为避免必须通过HTTPS身份验证重新输入密码,请参阅本文

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

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