简而言之,我在GitLab CI中有一个在图像上运行的管道alpine:latest
。在管道中我运行安装ssh
:
apk update && apk upgrade && apk add --update openssh
然后我运行一个scp
命令:
scp -P $SSH_PORT $FILES $SSH_USER@$SSH_HOST:~/
失败的原因是:
ssh: connect to host <host> port <port>: Connection refused
scp: Connection closed
在服务器上我可以看到日志:
Unable to negotiate with <ip> port <port>: no matching host key type found. Their offer: [email protected] [preauth]
Unable to negotiate with <ip> port <port>: no matching host key type found. Their offer: [email protected] [preauth]
在研究并尝试了解整个过程如何工作之后,我尝试PubkeyAcceptedKeyTypes
在scp
命令中添加选项,以便客户端接受服务器提供的用于身份验证的主机密钥:
scp -o '[email protected]' -P $SSH_PORT $FILES $SSH_USER@$SSH_HOST:~/
但不幸的是一切都没有改变。
有人有什么想法吗?