8

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 git@github.com' in cygwin, but it always hang on there. Here is the output:

$ ssh -vT git@github.com
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

Eason
  • 338
  • 5
  • 11

4 Answers4

10

Make sure you did copy the public key as one line, because a copy from an editor can sometime buffer the content of that key as several lines.

If you still have an issue, check other SSH debug tips at "Unable to Git-push master to Github".
A ssh -vvvT git@github.com can display more debug information.


The OP Eason Wu comments:

I found the real reason of this problem, it is caused by my network.
Some websites are prohibited by my company, I would think it also affects GitHub service.
After I turn on an VPN connection, and retest again with ssh -vvvT git@github.com, it passed successfully

Catskul
  • 17,916
  • 15
  • 84
  • 113
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yeah, I did copy it in one line. I also created a config file like the tip mentioned, it still doesn't work. And after use option `-vvvT`, it throw a new message out, `Could not load "/home/eason.wu/.ssh/id_rsa" as a RSA1 public key`, not sure if my key is not correct? But I generate the key following https://help.github.com/articles/generating-ssh-keys. It's very strange. Anyway, thanks for your reply. – Eason Jul 30 '12 at 07:39
  • @EasonWu check you `.ssh` protection: see http://stackoverflow.com/questions/3712443/creating-ssh-keys-for-gerrit-and-hudson/3712619#3712619 – VonC Jul 30 '12 at 07:53
  • I added full control over the log on user for the file under .ssh, still cannot connect to server. I download the tool provided by github, it works well via SSH way, there should be some steps I did wrong. Thanks for your suggestion!!! – Eason Jul 30 '12 at 09:21
  • 1
    I found the real reason of this problem, it is caused by my network. Some website are prohibited by my company, I would think it also affects github service. After I turn on an VPN connection, and retest again with `ssh -vvvT git@github.com`, it passed successfully. – Eason Aug 01 '12 at 02:13
  • @EasonWu Excellent. I have included your conclusion in the answer for more visibility. – VonC Aug 01 '12 at 05:47
  • I had the same problem, but after testing with this ssh command, it asked me to recognize the host key, and this solved the question here. – Thiago Chaves Jan 21 '23 at 21:14
  • @ThiagoChaves Did you mean it ask you about `known_hosts`? – VonC Jan 22 '23 at 00:07
  • @VonC yes, that's right. – Thiago Chaves Jun 23 '23 at 13:54
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

PrestonR
  • 11
  • 2
0

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.

DylanR
  • 25
  • 1
  • 5
-2

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.