我正在尝试克隆当前使用SSH公钥/私钥而不是密码配置的git repo。我可以使用PuTTy SSH登录,并使用以下命令生成密钥(这是一个基于Unix的服务器)。
$ ssh-keygen -t rsa "john@mysite.com"
这将在我的.ssh/目录下生成两个文件。
我遇到的问题基本上是试图通过一个常见的git客户端(如SourceTree)将相同的git repo克隆到我的本地Windows桌面。
当我尝试通过SourceTree检查时,它显示如下:-
SSH Authentication Failed
Your SSH agent (Pageant) is running but the server still rejected your connection...
我已经安装了Pagent,但不确定从这里做什么?任何想法…
——update——当我在远程服务器上打开私钥时,这是结构(显然更长&为了安全起见,我已经更改了它…)
-----BEGIN RSA PRIVATE KEY-----
MIIEoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END RSA PRIVATE KEY-----
将ssh客户端更改为openssh。之后,您需要创建一对新的密钥并将其添加到存储库主机。
可以使用
创建ssh密钥ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"