After updating to Catalina 10.15.4, git started hanging indefinitely when trying to push or pull from a repo that was previously accessible.

$ git push origin master

The URL for origin looks like:

$ git remote -v
origin  ssh://[email protected]:30814/username/project.git (fetch)
origin  ssh://[email protected]:30814/username/project.git (push)

Attempting to ssh directly to the remote results in a hang:

$ /usr/bin/ssh -p 30814 [email protected] -vvv
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to gitlab.example.com port 30814.

Which seems to indicate the underlying problem with git is the ssh:// URI for the remote repository. I confirmed this by successfully cloning the repo using a https:// URI.

3 Answers 3


Debugging steps:

  1. Attempted to connect with netcat:
$ nc -v gitlab.example.com 30814
Connection to gitlab.example.com port 30814 [tcp/*] succeeded!
  1. Suspecting a broken ssh client, I installed openssh using brew:
$ brew install openssh
$ /usr/local/bin/ssh  -V
OpenSSH_8.2p1, OpenSSL 1.1.1d  10 Sep 2019

$ /usr/local/bin/ssh -p 30814 [email protected]
Welcome to GitLab, @username!
Connection to gitlab.example.com closed.

After refreshing my shell environment to ensure that the new ssh is found in my $PATH, git operations began functioning as expected with ssh:// URIs.

Searching turned up this user submitted bug: ssh fails when using -p flag

The workaround detailed in the bug is to use the remote host's IP address instead of the DNS name. I can confirm that this worked for me:

$ /usr/bin/ssh -V
OpenSSH_8.1p1, LibreSSL 2.7.3

$ /usr/bin/ssh -p 30814 [email protected]
Welcome to GitLab, @username!
Connection to gitlab.example.com closed.

The apparent trigger for this bug is using ports greater than 8192 in conjunction with a host's DNS name.


This one fixed it for me:

brew uninstall openssl --ignore-dependencies; brew uninstall openssl --ignore-dependencies; brew uninstall libressl --ignore-dependencies; brew install openssh;

results in

OpenSSH_8.3p1, OpenSSL 1.1.1g  

being used by ssh ...


FWIW I ran into this issue with Monterey 12.7.2.

I regenerated ssh keys (not sure if this was the critical bit) and changed ~/.ssh/config to have

Host github.com
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
  UseKeychain no

Hope this saves someone some time.

You must log in to answer this question.

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