简体   繁体   English

我可以对单个 git 帐户同时使用 SSH 和 HTTPS 吗?

[英]Can I use SSH and HTTPS both for single git account?

If i use SSH then I have to download git repository using git ssh but if I use HTTPS then https is the way.如果我使用SSH ,那么我必须使用 git ssh 下载 git 存储库,但如果我使用HTTPS ,那么 https 就是方法。

Can I download those git repo using both way for a single account?我可以为单个帐户使用两种方式下载这些 git repo 吗?

The account is what the remote hosting service will use to authenticate you and determine if you have the right to access the remote repository you want to clone.该帐户是远程托管服务将用来对您进行身份验证并确定您是否有权访问要克隆的远程存储库的帐户。

  • for HTTPS, it will be the username/password对于 HTTPS,它将是用户名/密码
  • for SSH, it will be the public key published to your remote account profile setting (while the actual remote user for an SSH session is almost always a technical account like 'git': git@remoteServer:Me/MyRepository )对于 SSH,它将是发布到您的远程帐户配置文件设置的公钥(而 SSH 会话的实际远程用户几乎总是像“git”这样的技术帐户: git@remoteServer:Me/MyRepository

If the remote hosting service supports both protocols, the same user account can clone using either one of them.如果远程托管服务支持这两种协议,则同一用户帐户可以使用其中任何一种进行克隆。


If you are using HTTPS, make sure:如果您使用的是 HTTPS,请确保:

That is:那是:

git config --global credential.helper

I recommend setting it to manager-core , using the Microsoft Git Credential Manager (GCM) (cross-platform).我建议使用Microsoft Git Credential Manager (GCM) (跨平台)将其设置为manager-core
It is already packaged/set with Git For Windows for instance.例如,它已经使用Git For Windows打包/设置。

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

相关问题 如何在Bitbucket上将git与ssh一起使用 - How can I use git with ssh on bitbucket 通过HTTPS或SSH使用Git的最佳方法是什么? - What is the best way to use Git, with HTTPS or with SSH? Gitlab-git clone在macOS中因ssh和https均失败 - Gitlab - git clone failed both with ssh and https in macOS Git子模块:可以提供对子模块的https和ssh访问吗? - Git Submodules: It is possible to provide both https and ssh access to submodules? 我可以使用git代理配置从git:映射到https:吗? - can I use a git proxy configuration to map from git: to https:? 我可以使用两个不同的 Git 和它们各自的 SSH 密钥吗? - Can I use two different Git with their respective SSH Key? 我可以使用ssh密钥进行Azure git push部署吗? - Can I use an ssh key for Azure git push deployment? 将SSH密钥添加到Github后,为什么不能继续使用https对git进行身份验证? - Why can I not keep authenticating git with https after having added SSH key to Github? 我可以将 git 子模块与某种后备 URL 链接吗? 如果 SSH 克隆失败,git 应该能够使用 https 进行克隆 - Can I link git submodules with some kind of fallback URL? If SSH clone fails, git should be able to clone using https Git子模块最佳实践 - 总是在https上使用ssh协议? - Git submodules best practice - always use ssh protocol over https?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM