Suddenly started to receive ssh_exchange_identification error using git/bitbucket

Viewed 2564

Nothing was changed in the system. I work as usually. And usually there was no any problems with pull/push. I have access on bitbucket, if I visit it via the browser.

And now when I try to push or pull from bitbucket repository, I get error:

ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

Below is a command with verbose output, but I cannot understand what is the problem.

Command used for verbose output: $ GIT_SSH_COMMAND="ssh -vvv" git pull

The output:

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/volk/.ssh/config
debug1: /Users/volk/.ssh/config line 48: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolving "bitbucket.org" port 22
debug2: ssh_connect_direct
debug1: Connecting to bitbucket.org [18.205.93.2] port 22.
debug1: Connection established.
debug1: identity file /Users/volk/.ssh/id_rsa type 0
debug1: identity file /Users/volk/.ssh/id_rsa-cert type -1
debug1: identity file /Users/volk/.ssh/id_dsa type -1
debug1: identity file /Users/volk/.ssh/id_dsa-cert type -1
debug1: identity file /Users/volk/.ssh/id_ecdsa type -1
debug1: identity file /Users/volk/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/volk/.ssh/id_ed25519 type -1
debug1: identity file /Users/volk/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/volk/.ssh/id_xmss type -1
debug1: identity file /Users/volk/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
3 Answers

Got same issue today.

Fixed the issue via add following lines in ssh config(vim ~/.ssh/config)

Host bitbucket.org
  AddKeysToAgent yes
  HostName altssh.bitbucket.org
  IdentityFile ~/.ssh/id_rsa
  UseKeychain yes
  Port 443

It might be a problem with Bitbucket.

Check Bitbucket status https://bitbucket.status.atlassian.com/history


That's what happened to me and the original poster, but I didn't think to check until seeing the comment on the question here.

Related