问题
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
回答1:
The ISP has Blocked the Port 22. Solved !
回答2:
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.
回答3:
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
来源:https://stackoverflow.com/questions/45518078/ssh-connection-timed-out