SSH stopped working suddenly. I am using macOS 10.13.4. I am getting timeout every time today but all was working yesterday. I have added my public key to GitHub. I get the following output upon running ssh:

$ssh -vvv -T [email protected] 
OpenSSH_7.7p1, OpenSSL 1.0.2o  27 Mar 2018
debug1: Reading configuration data /Users/nurrony/.ssh/config
debug1: /Users/nurrony/.ssh/config line 30: Applying options for github.com
debug1: /Users/nurrony/.ssh/config line 47: Applying options for *
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug2: resolving "github.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to github.com [] port 22.
debug1: connect to address port 22: Operation timed out
debug1: Connecting to github.com [] port 22.
debug1: connect to address port 22: Operation timed out
ssh: connect to host github.com port 22: Operation timed out

My ~/.ssh/config reads as follows:

Host github.com
  ControlMaster auto
  ControlPersist 120
  HostName github.com
  User git
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/nur-macbookpro
Host *
  # Always use SSH2.
  Protocol 2

  # Use a shared channel for all sessions to the same host,
  # instead of always opening a new one. This leads to much
  # quicker connection times.
  ControlMaster auto
  Controlpath /tmp/ssh-%r@%h:%p
  ControlPersist 1800

  # also this stuff
  Compression yes
  TCPKeepAlive yes
  ServerAliveInterval 20
  ServerAliveCountMax 10

I have tried every suggestion found by Web search but nothing is working. I can ssh fine when I connect my Mac with mobile hotspot.

How do I resolve this issue?

  • Please post an answer and not an "update" within the question. You can then select that answer as your solution so it can be marked as "solved."
    – Allan
    Commented Aug 26, 2020 at 16:37

2 Answers 2


Answering question on behalf of OP to close the loop. See revision history for source information.

The issue has been resolved. It turns out that the ISP was blocking traffic port 22. I had to contact the ISP to get this fixed.


Have you tried the following:

  1. Are your identities active? (running: ssh-add -l will tell you).
  2. Since you're keeping your connections alive in the background for Github (not sure why you'd want to do that) once you go idle, the connection may lock you out.
  3. Have you checked your firewall settings to make sure port 22 access is enabled on your end?
  • thanks for your answer. nothing is working 1. I had my id active 2. removed my config 3. firewall is off
    – Nur Rony
    Commented Apr 15, 2018 at 3:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .