我在 /root/.ssh/config
文件中配置了 ssh
:
Host *
IdentityFile /root/.ssh/id_rsa_api
IdentityFile /root/.ssh/id_rsa_ui
我使用这些密钥来克隆GitHub存储库。然而,只有第一个IdentityFile
(API)起作用。对于第二个,当我开始克隆时,它会显示存储库未找到
。当我交换配置后,就像这样:
Host *
IdentityFile /root/.ssh/id_rsa_ui
IdentityFile /root/.ssh/id_rsa_api
我可以克隆UI,但无法克隆API。因此,我发现密钥是正确的,但第二个IdentityFile总是被忽略。问题可能是什么?
我不能使用ssh-add,因为我在Dockerfile中配置了ssh
,而当容器构建时,ssh-agent没有运行。
ssh-add
添加它们。 - larsks