从 windows10 ssh 到 docker 容器以询问密码结束

从 windows10 ssh 到 docker 容器以询问密码结束

我正在尝试在安装在 Windows 10 计算机上的 docker 容器中测试 gitlab。但是当我尝试推送我的代码时,它以询问 git 的密码结束。当我使用 ssh -vT 测试连接时,输出如下:

>ssh -vT git@localhost
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\BOB/.ssh/config
debug1: C:\\Users\\BOB/.ssh/config line 3: Applying options for localhost
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\BOB/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\BOB/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:rzl1PhGalyEdQaj98v1CZZwrrSOnckCrugo/eq2c1m0
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\BOB/.ssh/known_hosts:5
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:8ZFKmbGFtI0mtmXIPl/LcxuehEsrCxtLeOqLL9mT0+8 C:\\Users\\BOB/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@localhost's password:

有人知道吗?

答案1

我的错 !

由于我的docker是本地安装的,所以它也被称为localhost。

所以端口 22 是用于真正的本地主机,我的 docker ssh 端口是 8222...

编辑:事实上,这似乎更糟

  >ssh -vt git@localhost
  openssh_for_windows_7.7p1, libressl 2.6.5
  debug1: reading configuration data c:\\users\\bob/.ssh/config
  debug1: c:\\users\\bob/.ssh/config line 3: applying options for localhost
  debug1: connecting to localhost [127.0.0.1] port 8222.
  debug1: connection established.
  debug1: identity file c:\\users\\bob/.ssh/id_rsa type 0
  debug1: key_load_public: no such file or directory
  debug1: identity file c:\\users\\bob/.ssh/id_rsa-cert type -1
  debug1: local version string ssh-2.0-openssh_for_windows_7.7
  debug1: remote protocol version 2.0, remote software version openssh_7.2p2 ubuntu-4ubuntu2.8
  debug1: match: openssh_7.2p2 ubuntu-4ubuntu2.8 pat openssh* compat 0x04000000
  debug1: authenticating to localhost:8222 as 'git'
  debug1: ssh2_msg_kexinit sent
  connection closed by 127.0.0.1 port 8222

相关内容