Git Clone Error: Ssh_Exchange_Identification: Connection Closed by Remote Host

Git Clone Error: Ssh_Exchange_Identification: Connection Closed by Remote Host

gitlab9.3.9 upgrade to 11.9, git pull OR git clone don't work

My surroundings:
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 '
        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'

Try in my client PC OR Server's container(gitlab_web) :
Re-created my ssh keys and rm ~/.ssh/known_hosts , but git pull OR clone problem still exists:

$ git clone ssh://: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.

Ask for help

1

1 Answer

fix:
Server work:
1. change Gitlab server host SSH port from 22 to 222 and restart ssh service

$vi /etc/ssh/sshd_config
$/etc/init.d/ssh restart
  1. docker-compose.yaml add ssh port 22
ports:
  - '8081:8081'
  - '22:22'
  1. docker-compose down
  2. docker-compose up -d

Client work:

delete ~/.ssh/known_hosts  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.