linux - ssh -t 在 vps 上由 docker 托管的 gitlab 服务器上不断询问密码
问题描述
我正在尝试构建一个网络服务器,我可以在其中将某些回购分支分配给不同的域,以便我可以轻松地测试和部署到我的实时网络应用程序。所以此刻,我有 3 个 docker 容器正在运行(Mysql、PHPMyAdmin 和 Gitlab)。我设法设置 Gitlab 来接管我在 Github 上托管的存储库,现在我正试图能够提交对我的 vpn 托管存储库的更改。然而,似乎即使我的密钥已设置并被识别,我仍然会收到密码提示。
服务器运行 Ubuntu 18.04 和 Docker 19.03.1。我正在通过 Windows 7 机器 cmd 终端进行连接。我计划在这台服务器上运行几个具有不同域的不同站点。
“docker ps”返回以下内容:
xxxxxxxxxxxx gitlab/gitlab-ce "/assets/wrapper" 45 hours ago Up 45 hours (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 22/tcp, 0.0.0.0:30022->30022/tcp gitlab
xxxxxxxxxxxx phpmyadmin/phpmyadmin "/docker-entrypoint.…" 2 days ago Up 2 days 0.0.0.0:8081->80/tcp phpmyadmin
xxxxxxxxxxxx mysql:8.0.1 "docker-entrypoint.s…" 2 days ago Up 2 days 3306/tcp mysql-server
如果我运行“ssh -Tv” git@gitlab.myserver.net 我会得到以下结果:
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gitlab.myserver.net [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /c/Users/user/.ssh/id_rsa type -1
debug1: identity file /c/Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/user/.ssh/id_dsa type -1
debug1: identity file /c/Users/user/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/user/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/user/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/user/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/user/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/user/.ssh/id_xmss type -1
debug1: identity file /c/Users/user/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to gitlab.myserver.net:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:SOMERANDOMSTRINGOFCHARACTERS
debug1: Host 'gitlab.myserver.net' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/user/.ssh/known_hosts:6
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: Will attempt key: My Name and Last name RSA SHA256:SOMERANDOMSTRINGOFCHARACTERS agent
debug1: Will attempt key: /c/Users/user/.ssh/id_rsa
debug1: Will attempt key: /c/Users/user/.ssh/id_dsa
debug1: Will attempt key: /c/Users/user/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/user/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/user/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: My First and Last Name RSA SHA256:SOMERANDOMSTRINGOFCHARACTERS agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/user/.ssh/id_rsa
debug1: Trying private key: /c/Users/user/.ssh/id_dsa
debug1: Trying private key: /c/Users/user/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/user/.ssh/id_ed25519
debug1: Trying private key: /c/Users/user/.ssh/id_xmss
debug1: Next authentication method: password
它似乎试图提供我存储在我的用户代理中的注册密钥(我通过选美提供这个)。然而,在它检查了每个可能的位置以获取密钥并决定要使用密钥或密码进行身份验证之后,它只是跳过密钥并提示我输入密码。
我尝试了 GitLab 支持的几种不同的密钥类型,我尝试将“ssh://”放在路径前面,但这只会使其无法连接到服务器。我尝试在 GitLab 和 Docker 文档以及 SO 和其他故障排除站点中搜索类似问题,但我似乎找不到类似的情况。解决这个问题的最佳方法是什么?
解决方案
推荐阅读
- docker - 我可以同时运行 windows 和 linux 容器吗?码头工人
- c++ - Qt QGraphicsView 滚动导致项目随机消失
- windows - 为什么设置推荐使用先前的用户输入输入?
- php - 在 WP_Query 中将字符串作为数字进行比较
- machine-learning - 猜测超车道的值(软边距分类器)
- typescript - 从 webview 向扩展发送消息
- google-apps-script - 如何将 Google 照片中的一张图片添加到 HTML 模板以发送电子邮件?
- api - Pinterest 开发者 API v3 应用程序仍在等待中
- html - CSS中的中心页脚
- excel - ListBox(用户窗体)VBA中的多列