Sergej
Sergej

Reputation: 2196

Suddenly started to receive ssh_exchange_identification error using git/bitbucket

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

Upvotes: 4

Views: 6210

Answers (3)

user14301906
user14301906

Reputation: 77

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.

Upvotes: 1

Zilong Wang
Zilong Wang

Reputation: 584

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

Upvotes: 3

Aarthy sekar
Aarthy sekar

Reputation: 1

I also faced a similar issue all of a sudden. I tried of couple of suggestions given in ssh_exchange_identification: Connection closed by remote host under Git bash but the following one worked for me.

  1. Delete ssh folder (~/.ssh)
  2. Recreate .ssh using ssh-keygen
  3. Configure the latest public key
  4. Then now try your git commands

Upvotes: 0

Related Questions