My SSH key has gone missing from my account and I can't add it back. What can I do about this?
Asked by Daniel Clubb:

I have been working on a project for a few weeks now using ssh key. However today I tried to push some changes and received this error:

***kex_exchange_identification: read: Operation timed out***   
***fatal: Could not read from remote repository.***

***Please make sure you have the correct access rights***   
***and the repository exists.***

I then tried again and received a similar but slightly different error:

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

***Please make sure you have the correct access rights***   
***and the repository exists.***

When I saw this I went a checked both the access keys for the repo and my account SSH keys. The repo access keys was empty and said 'there are no keys configured' ![Screenshot 2021-11-29 at 10.42.14.png](/t5/image/serverpage/image-id/171203i24AFA5C79D3E270A/image-size/large?v=v2&px=999 "Screenshot 2021-11-29 at 10.42.14.png"). My account ssh keys only had a default public key![Screenshot 2021-11-29 at 10.42.41.png](/t5/image/serverpage/image-id/171204i20BB1606E9ED9D15/image-size/large?v=v2&px=999 "Screenshot 2021-11-29 at 10.42.41.png").

I then tried to add my ssh key back to both the repo and my account, however, when I did I would be told ***'Someone has already added that SSH key to another account'.***When Looking online to resolve this I came across this command

    ssh -T git@bitbucket.org

This would give me an error again

***kex_exchange_identification: read: Operation timed out***

I only have one account and have only used the one SSH key.


Answers:
author: Theodora Boudale
body: Hi Daniel and welcome to the community!

**Access keys** that are added to a repo provide read-only access to repositories. If you add an SSH key to a repo, you will only be able to clone and pull this repo and not push.

If you want to be able to push via SSH to repos you have access to, the public SSH key needs to be added to your account (like in the second screenshot you attached). In that screenshot, there is a key listed. If you select the pencil icon in that entry, you'll be able to view the public SSH key and check if it's the same as the public key on your machine. If they are the same, then this shouldn't be an issue.

* Are you perhaps connected to a different network now (different from the one when the push was succeeding) or are you still using the same network?
* If you're behind a firewall, you may need to whitelist our IP addresses to be able to reach Bitbucket:
  * <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/>
* Are you able to push using **git push -4** ? This will use IPv4 addresses only, and I'm asking you to check because I've sometimes seen this error occur when IPv6 is used and there is some misconfiguration.
* Are you able to push to the repo using HTTPS? I ask this so we can narrow down if the issue seems to be specific to SSH or not. If it works, you could also use HTTPS as a workaround until we figure out the SSH issue, so you can push your changes.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora

comments: author: Daniel Clubb
body: Hey, thank you for the answer.

I believe I was having the problem as I was on a different network. Now I'm back on the network I usually use and everything works as normal.


Tags: bitbucket-cloud

cloud