我在执行以下命令时从 github 帐户 abd 中删除 ssh 密钥:
git clone git@xxx.git
它提示密码输入,我给出密码,但它给了我:
Permission denied, please try again.
我确保密码有效,因为我可以使用它来登录我的 github。我的困惑是服务器如何知道我是谁或git clone命令如何向服务器告诉我的身份?我怀疑也许服务器不知道我是谁,所以密码无法匹配。
服务器如何知道我是谁或 git clone 命令如何告诉我的身份
取决于协议。对于https://
,您可以直接传递您的登录名/密码:
git clone https://user:passwd@example.com/repo.git
如果您未提供密码:
git clone https://user@example.com/repo.git
git
要求它。
但是有了ssh
协议
git clone ssh://git@example.com/repo.git
或
git clone git@example.com:repo.git
登录名是git
因此服务器对您进行身份验证的唯一方法是通过 SSH 密钥对。也就是说,服务器必须知道您的公钥。