![git clone 错误:ssh_exchange_identification:远程主机关闭连接](https://linux22.com/image/1588266/git%20clone%20%E9%94%99%E8%AF%AF%EF%BC%9Assh_exchange_identification%EF%BC%9A%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E5%85%B3%E9%97%AD%E8%BF%9E%E6%8E%A5.png)
gitlab9.3.9 升级到 11.9,git pull 或 git clone 不起作用
我的环境:
docker-compose.yaml
web:
image: 'gitlab-ce:11.9.1-ce.0'
container_name: gitlab_web
restart: always
hostname: 'gitlabweb'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://cicd.poc.com:8081'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['admin_email_worker_cron'] = "0 0 * 0 *"
gitlab_rails['gitlab_shell_ssh_port'] = 8081
nginx['listen_port'] = 8081
ports:
- '8081:8081'
volumes:
- './git_data:/var/opt/gitlab'
- './gitconfig:/etc/gitlab'
- './git_log:/var/log/gitlab'
在我的客户端 PC 或服务器的容器(gitlab_web)中尝试:
重新创建我的 ssh 密钥并 rm ~/.ssh/known_hosts ,但 git pull 或 clone 问题仍然存在:
$ git clone ssh://[email protected]:8081/poc/53.git
Cloning into '53'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
请求帮忙
答案1
修复:
服务器工作:
1.将Gitlab服务器主机SSH端口从22更改为222并重新启动ssh服务
$vi /etc/ssh/sshd_config
$/etc/init.d/ssh restart
- docker-compose.yaml 添加 ssh 端口 22
ports:
- '8081:8081'
- '22:22'
- docker-compose down
- docker-compose up -d
客户工作:
delete ~/.ssh/known_hosts