ssh_exchange_identification: Connection closed by remote host under Git bash

后端 未结 26 2521
梦谈多话
梦谈多话 2021-01-30 08:57

I work at win7 and set up git server with sshd. I git --bare init myapp.git, and clone ssh://git@localhost/home/git/myapp.git in Cywgin

相关标签:
26条回答
  • 2021-01-30 09:28

    Hit the following ssh restart command in linux

    prayag@prayag:~/backup/NoisyNeighbour$ service ssh restart 
    stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.75" (uid=1417676764 pid=5933 comm="stop ssh ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
    start: Rejected send message, 1 matched rules; type="method_call", sender=":1.76" (uid=1417676764 pid=5930 comm="start ssh ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
    
    0 讨论(0)
  • 2021-01-30 09:28

    For fixing the issues add the Hostname for Git on ~/.ssh/config,

    Host github.com
     Hostname ssh.github.com
     Port 443
    

    In my case github!

    0 讨论(0)
  • 2021-01-30 09:28

    After removing/deleting the rm ~/.ssh/known_hosts, my issue was fixed

    0 讨论(0)
  • 2021-01-30 09:28

    We migrated our git host instance/servers this morning to a new data center and while being connected to both: VPN (from remote/home) or when in office network, I got the same error and was not able to connect to clone any GIT repo.

    Cloning into 'some_repo_in_git_dev'...
    ssh_exchange_identification: Connection closed by remote host
    fatal: Could not read from remote repository.
    

    This will help if you are connecting to some or all servers via a jump host server.

    Earlier in my ~/.ssh/config file, my setting to connect were:

    Host * !ssh.somejumphost.my.company.com
         ProxyCommand ssh -q -W %h:%p ssh.somejumphost.my.company.com
    

    What this means is, for any SSH based connection, it will connect to any * server via the given jump host server except/by ignoring "ssh.somejumphost.my.company.com" server (as we don't want to connect to a jump host via jump host server.

    To FIX the issue, all I did was, change the config to ignore git server as well:

    Host * !ssh.somejumphost.my.company.com !mycompany-git.server.com !OrMyCompany-some-other-git-instance.server.com
         ProxyCommand ssh -q -W %h:%p ssh.somejumphost.my.company.com
    

    So, now to connect to mycompany-git.server.com while doing git clone (git SSH url), I'm telling SSH not to use a jump host for those two extra git instances/servers.

    0 讨论(0)
  • 2021-01-30 09:29

    I solved it this way.

    ssh -vvv <username>@github.com to see github IP.

    Then opened browser and opened github via IP to find it was an issue with firewall.

    0 讨论(0)
  • 2021-01-30 09:29

    Just enter on the server side :

    echo 'SSHD: ALL' >> /etc/hosts.allow
    

    It sorted it out for me.

    0 讨论(0)
提交回复
热议问题