'Why my SSH hang on there while connecting to github?

This is what I tried to do ten times today without success:

  • make a key with ssh-keygen.
  • open ~/.ssh/id_rsa.pub with Gedit or Notepad++ and copy the contents.
  • Go to account settings on github.com
  • Go to SSH Keys
  • Click on the Add Key button.
  • give the key a title
  • paste the key into the key box.
  • Save the key (enter my github password to verify).

Then, I run '$ ssh -vT [email protected]' in cygwin, but it always hang on there. Here is the output:

$ ssh -vT [email protected]
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/eason.wu/.ssh/config
debug1: /home/eason.wu/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/eason.wu/.ssh/id_rsa type 1
debug1: identity file /home/eason.wu/.ssh/id_rsa-cert type -1

Does any one meet this problem, any solution will be appreciated



Solution 1:[1]

For anyone coming here recently looking for a solution, this was happening to me too, however in the debug (as per above instruction) the connection to GitHub never established.

My output looked like:

OpenSSH_7.9p1 Ubuntu-10, OpenSSL 1.1.1b  26 Feb 2019
debug1: Reading configuration data /home/preston/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "github.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to github.com [2607:7700:0:1a:0:1:c01e:ff70] port 22.

I noticed the IPv6 address in the last line and thought that might be the issue. So I sourced an article on changing it to use an IPv4 address in the global ssh settings.

Changing to IPv4 worked.

Source: https://stackoverflow.com/a/35113901/3818056

Solution 2:[2]

For me, the issue was the router I was connected to was using WPA, not WPA2/3. Once I changed to a network that didn't have this issue my repo was instantly cloned with ssh.

Solution 3:[3]

I solved this by adding GitHub "github.com" in the whitelist of my router. You can also overcome this by VPN however it will require another set of steps to find a VPN and setup.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PrestonR
Solution 2 DylanR
Solution 3 Farrukh Ishaq Choudhary