我正在尝试通过git
远程计算机检查某些内容。git
调用ssh -vvv
,在调试输出中我可以看到:
debug1: Will attempt key: /home/circleci/.ssh/id_rsa RSA SHA256:YaH**************************************** agent
debug1: Will attempt key: ED25519 SHA256:cPD9**************************** agent
debug1: Will attempt key: /home/circleci/.ssh/id_dsa
debug1: Will attempt key: /home/circleci/.ssh/id_ecdsa
debug1: Will attempt key: /home/circleci/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/circleci/.ssh/id_ed25519
debug1: Will attempt key: /home/circleci/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/circleci/.ssh/id_xmss
再往下
debug1: Server accepts key: /home/circleci/.ssh/id_rsa RSA SHA256:YaH**************************************** agent
debug3: sign_and_send_pubkey: RSA SHA256:YaH****************************************
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:YaH****************************************
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
但是克隆失败了,因为这实际上是错误的密钥;正确使用的键是第二个(开始cPD9
)。
如何强制 ssh 优先使用第二个密钥?
通常情况下,我会这样做ssh -i ./path/to/key/id_rsa
,但在这种情况下,密钥由 CircleCI 添加到钥匙串中。 IE虚拟机中没有包含此密钥的文件。这在日志文件中很明显,其中第二行没有文件路径。我唯一知道的是密钥的摘要,我想强制 SSH 使用它。我浏览了手册页,但看不到任何明显的东西。