【发布时间】:2025-12-26 23:30:12
【问题描述】:
我有一个不使用密码的 SSH 密钥。我想在构建 Docker 容器时使用该密钥来拉取私有 git 存储库。
我在构建时成功地将密钥放入容器中,但现在 SSH 失败了,因为它无法打开 /dev/tty 来询问密钥的密码。如前所述,钥匙没有。
这是一些 SSH 输出 (-v)
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: No more authentication methods to try.
Permission denied (publickey).
fatal: Could not read from remote repository.
【问题讨论】:
-
请注意,我已经尝试使用in this thread建议的方法添加
/dev/tty