Permission denied when Pushing to Bitbucket after Sierra Update

956 Views Asked by At

I want to push some changes I made to Bitbucket. This worked well until I made the macOS Sierra update.

Now, I get the error (Pushing in SourceTree)

Please make sure you have the correct access rights and the repository exists. Pushing to ssh://[email protected]:xxx/xxx/xxxx.git Permission denied (publickey). fatal: Could not read from remote repository.

My key still exists. But the authentication is impossible. When I enter ssh -vT [email protected] in the console and say 'yes', it tries three private keys and prints

No more authentication methods to try.

Permission denied (publickey)

Any idea why this has happened and how I can fix it?

UPDATE Output of ssh -vT [email protected]:

OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /Users/corinna/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.com [104.192.143.7] port 22.
debug1: Connection established.
debug1: identity file /Users/corinna/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/corinna/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version conker_1.0.268-723a194 app-127
debug1: no match: conker_1.0.268-723a194 app-127
debug1: Authenticating to bitbucket.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa [many cryptical characters here]
debug1: Host 'bitbucket.com' is known and matches the RSA host key.
debug1: Found key in /Users/corinna/.ssh/known_hosts:4
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/corinna/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/corinna/.ssh/id_dsa
debug1: Trying private key: /Users/corinna/.ssh/id_ecdsa
debug1: Trying private key: /Users/corinna/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
1

There are 1 best solutions below

9
Dan Lowe On

Sierra brought some changes to the way ssh-agent works. Try adding this to ~/.ssh/config:

AddKeysToAgent yes