1

I am getting the following error while pushing to my code bitbucket. It is using .ssh and it worked perfectly earlier and suddenly following error occurred.

$ git push origin branch-name
Connection reset by 18.205.93.1 port 22
fatal: Could not read from remote repository.

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

1 Answers1

1

Assuming your access to that repository hasn't changed, and assuming nothing has changed in your network (such as a proxy server change), this looks most like an ssh-agent issue. You can see more detail of the attempted connection by running GIT_SSH_COMMAND="ssh -v" git push origin branch-name, or you can test your connection and key with ssh -Tv git@bitbucket.org. Both commands should include lines like these:

debug1: Server host key: ssh-rsa 
SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Offering public key: (key type, fingerprint, and path go here)
debug1: Server accepts key: (details about the accepted key go here)
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.1]:22).

(There will be other lines. Just look for these specific ones. You may also see a SHA1 fingerprint for the host key, if that's what your system prefers; that will be listed as 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40. If you don't see one of those host keys, then you're probably not actually getting to Bitbucket.)

You should also be able to run ssh-add -L and see the key you want to use for Bitbucket.

If your key is not listed in any output, then you can add it with ssh-add /path/to/key. You can also add that key's path as the IdentityFile in your ~/.ssh/config so that SSH always uses that key for that host:

Host bitbucket.org
    IdentityFile /path/to/key
Jim Redmond
  • 4,139
  • 1
  • 14
  • 18