6

I am not able to ssh in git to github or bitbucket or gitlab.
I typically have the following error message: how can I avoid it?

========== output ============

ssh -T git@github.com -i ~/.ssh/id_rsa -v
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.255.113] port 22.
debug1: connect to address 192.30.255.113 port 22: Connection timed out
debug1: Connecting to github.com [192.30.255.112] port 22.
debug1: connect to address 192.30.255.112 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
SARAVANAN SYR
  • 139
  • 1
  • 7
  • 1
    I suggest to first test connection with telnet: `telnet github.com 22`. If this test is successful, you can exclude a firewall and know that sshd is running. – Cyrus Aug 05 '17 at 06:51
  • Don't worry, ssh questions (all 18K of them) are on topic, especially when they are related to Git, a tool used for development. – VonC Aug 05 '17 at 07:38
  • @Cyrus it's not working telnet: Unable to connect to remote host: Connection timed out not only with github but also bitbucket & gitlab. – SARAVANAN SYR Aug 05 '17 at 14:12
  • 1
    `sudo nmap 192.30.255.113 -p 22` may also be helpful –  Aug 05 '17 at 17:38
  • Pretty sure, your corporate firewall is blocking all outgoing traffic to ssh. Verify it with some other network. – acsrujan Aug 05 '17 at 21:25
  • @acsrujan yes the isp have blocked the port 22.Thanks – SARAVANAN SYR Aug 06 '17 at 03:30

3 Answers3

3

The ISP has Blocked the Port 22. Solved !

SARAVANAN SYR
  • 139
  • 1
  • 7
1

Kill the SSH process and restart it. It has solved me similar issues. I have found that multiple instances of SSH, in that case you have to kill them all.

tymspy
  • 4,200
  • 2
  • 20
  • 35
0

This error message is typical when

  • the remote ssh daemon is not running (which is not the case here regarding GitHub, BitBucket or GitLab)
  • the local port 22 is blocked for outgoing connection (which is generally the case when working in enterprise: only http(s) is open, not ssh)

The OP confirms the ISP has blocked port 22.

See if you can use an https url instead:

cd /path/to/my/local/repo
git remote set-url origin https://github.com/<user>/<repo>

Note that with trystack, you might need to follow this gist

Click the Security Groups tab, click Edit Rules, and add a couple rules:

imcp, from port: -1, to port: -1, cidr: 0.0.0.0/0
tcp, from port: 22, to port: 22, cidr: your.ip.address.here/32
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250