我已经在linux框中运行了一个gitlab docker容器。 docker-composer的配置如下:
services:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
hostname: 'gitlab.example.com'
ports:
- '192.168.0.22:80:80'
- '192.168.0.22:443:443'
- '192.168.0.22:2222:22'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/opt/gitlab/data:/var/opt/gitlab'
environment:
- GITLAB_SSH_PORT = 2222
在MS Windows中,我尝试通过ssh从docker容器中克隆存储库。 为此,我已经在git bash shell中通过ssh-keygen生成了ssh密钥
ssh-keygen -t rsa -C "my@email.com"
并在gitlab Web界面中注册了公钥,并通过以下命令测试了ssh连接
ssh -vt git@192.168.0.22
调试消息说
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:5DpPwXu9nlXyzVXC8+H222hspaHRuSv9OXmFdAscIKM /d/home/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /d/home/.ssh/id_dsa
debug1: Trying private key: /d/home/.ssh/id_ecdsa
debug1: Trying private key: /d/home/.ssh/id_ed25519
debug1: Trying private key: /d/home/.ssh/id_xmss
debug1: Next authentication method: password
git@192.168.0.22's password:
似乎引用了正确的密钥(/d/home/.ssh/id_rsa),但要求输入密码而不是公共密钥。
我已经在stackoverflow和gitlab站点中搜索了此行为,但没有一个能解决此问题。
任何建议都会有所帮助。