git - 通过ssh git clone 时服务器如何获取用户信息而不添加ssh key

标签 git

执行以下命令时,我从 github 帐户 abd 中删除了 ssh key :

git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a8cfc1dce8d0d0d086cfc1dc" rel="noreferrer noopener nofollow">[email protected]</a>

它提示输入密码,我给出密码,但它给了我:

Permission denied, please try again.

我确保密码有效,因为我可以用它登录我的 github。我的困惑是服务器如何知道我是谁,或者 git clone 命令如何将我的身份告诉服务器?我怀疑服务器可能不知道我是谁,所以密码无法匹配。

最佳答案

how the server know who am I or how git clone command tell the Identity of me

取决于协议(protocol)。对于 https://,您直接传递您的登录名/密码:

git clone https://user:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bacadbc9c9cddefadfc2dbd7cad6df94d9d5d7" rel="noreferrer noopener nofollow">[email protected]</a>/repo.git

如果您不提供密码:

git clone https://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88fdfbedfac8edf0e9e5f8e4eda6ebe7e5" rel="noreferrer noopener nofollow">[email protected]</a>/repo.git

git 要求它。

但是使用ssh协议(protocol)

git clone ssh://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2a4d435e6a4f524b475a464f04494547" rel="noreferrer noopener nofollow">[email protected]</a>/repo.git

git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="75121c0135100d14180519105b161a18" rel="noreferrer noopener nofollow">[email protected]</a>:repo.git

登录名是git,因此服务器对您进行身份验证的唯一方法是通过 ssh key 对。也就是说服务器必须知道你的公钥。

关于git - 通过ssh git clone 时服务器如何获取用户信息而不添加ssh key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55649042/

相关文章:

git - 什么 Git '--progress' 标志是什么以及如何使用它

django - 从 github 检索私有(private)存储库提交

git - .gitignore 文件的对面?

git - 为什么 `rm -rf` 在 git post-receive hook 中使用时的行为与 shell 不同?

git - git 中等效的 CVS 符号模块

git - 为什么我会与 git rebase -p -i 发生冲突?

git submodule update --init 给出 fatal error : Needed a single revision Unable to find current revision in submodule path

git - 忽略特定的提交,但留在头脑中

git - 将 GIT LFS 与 artifactory 集成有什么优势

git - 从 git gui 自动签名提交