SSH connection is success, I wanted to push my local code to online bitbucket repo.
Asked by Renuka Rajkumar:

Please anyone help me. I have made ssh key linked in bitbucket. I am not able to connect my local code to bitbucket. Please help me to correct where am I missing. Please find below error msg from git:

$ ssh -v git@bitbucket.org  
OpenSSH_8.9p1, OpenSSL 1.1.1n 15 Mar 2022  
debug1: Reading configuration data /etc/ssh/ssh_config  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::22c0:3470\] port 22.  
debug1: connect to address 2406:da00:ff00::22c0:3470 port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::22cd:e0db\] port 22.  
debug1: connect to address 2406:da00:ff00::22cd:e0db port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::6b17:d1f5\] port 22.  
debug1: connect to address 2406:da00:ff00::6b17:d1f5 port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::3403:4be7\] port 22.  
debug1: connect to address 2406:da00:ff00::3403:4be7 port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::22c5:2ef4\] port 22.  
debug1: connect to address 2406:da00:ff00::22c5:2ef4 port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[2406:da00:ff00::22e9:9f55\] port 22.  
debug1: connect to address 2406:da00:ff00::22e9:9f55 port 22: Connection timed out  
debug1: Connecting to bitbucket.org \[104.192.141.1\] port 22.  
debug1: Connection established.  
debug1: identity file /c/Users/renuh/.ssh/id_rsa type 0  
debug1: identity file /c/Users/renuh/.ssh/id_rsa-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ecdsa type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ecdsa-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ecdsa_sk type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ecdsa_sk-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ed25519 type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ed25519-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ed25519_sk type -1  
debug1: identity file /c/Users/renuh/.ssh/id_ed25519_sk-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_xmss type -1  
debug1: identity file /c/Users/renuh/.ssh/id_xmss-cert type -1  
debug1: identity file /c/Users/renuh/.ssh/id_dsa type -1  
debug1: identity file /c/Users/renuh/.ssh/id_dsa-cert type -1  
debug1: Local version string SSH-2.0-OpenSSH_8.9  
debug1: Remote protocol version 2.0, remote software version conker_daf2fe3bd1 3472e60801f0  
debug1: compat_banner: no match: conker_daf2fe3bd1 3472e60801f0  
debug1: Authenticating to bitbucket.org:22 as 'git'  
debug1: load_hostkeys: fopen /c/Users/renuh/.ssh/known_hosts2: No such file or directory  
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory  
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory  
debug1: SSH2_MSG_KEXINIT sent  
debug1: SSH2_MSG_KEXINIT received  
debug1: kex: algorithm: curve25519-sha256@libssh.org  
debug1: kex: host key algorithm: rsa-sha2-512  
debug1: kex: server-\>client cipher: chacha20-poly1305@openssh.com MAC: \<implicit\> compression: none  
debug1: kex: client-\>server cipher: chacha20-poly1305@openssh.com MAC: \<implicit\> compression: none  
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY  
debug1: SSH2_MSG_KEX_ECDH_REPLY received  
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A  
debug1: load_hostkeys: fopen /c/Users/renuh/.ssh/known_hosts2: No such file or directory  
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory  
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory  
debug1: Host 'bitbucket.org' is known and matches the RSA host key.  
debug1: Found key in /c/Users/renuh/.ssh/known_hosts:2  
debug1: rekey out after 134217728 blocks  
debug1: SSH2_MSG_NEWKEYS sent  
debug1: expecting SSH2_MSG_NEWKEYS  
debug1: SSH2_MSG_NEWKEYS received  
debug1: rekey in after 134217728 blocks  
debug1: get_agent_identities: bound agent to hostkey  
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_rsa RSA SHA256:1Oo1Qh2OW8mvq72uLHj3P/l3jt9osZuy9RKVihf1ejc  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_ecdsa  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_ecdsa_sk  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_ed25519  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_ed25519_sk  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_xmss  
debug1: Will attempt key: /c/Users/renuh/.ssh/id_dsa  
debug1: SSH2_MSG_EXT_INFO received  
debug1: kex_input_ext_info: server-sig-algs=\<ecdsa-sha2-nistp256,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp521-cert-v01@openssh.com\>  
debug1: SSH2_MSG_SERVICE_ACCEPT received  
debug1: Authentications that can continue: publickey  
debug1: Next authentication method: publickey  
debug1: Offering public key: /c/Users/renuh/.ssh/id_rsa RSA SHA256:1Oo1Qh2OW8mvq72uLHj3P/l3jt9osZuy9RKVihf1ejc  
debug1: Server accepts key: /c/Users/renuh/.ssh/id_rsa RSA SHA256:1Oo1Qh2OW8mvq72uLHj3P/l3jt9osZuy9RKVihf1ejc  
Authenticated to bitbucket.org (\[104.192.141.1\]:22) using "publickey".  
debug1: channel 0: new \[client-session\]  
debug1: Entering interactive session.  
debug1: pledge: filesystem  
PTY allocation request failed on channel 0  
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled  
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0  
debug1: channel 0: free: client-session, nchannels 1  
Connection to bitbucket.org closed.  
Transferred: sent 3552, received 2296 bytes, in 0.5 seconds  
Bytes per second: sent 6669.3, received 4311.0  
debug1: Exit status 0

renuh@Renu MINGW64 /c/users/renuh/LearnReact/git-test (master)  
$ git push -u origin master  
git@github.com: Permission denied (publickey).  
fatal: Could not read from remote repository.

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


Answers:
author: Ben
body: G'day Renuka!

Welcome to the Bitbucket Cloud community!

Thank you for providing the output, it appears that the SSH key which is being loaded is:

```
/c/Users/renuh/.ssh/id_rsa
```

Please verify first that this file path exists first on your local machine. Once verified, run the following command below.   
This will copy the contents of your public key to your clipboard. Once copied, paste this public key within **Personal Settings \> Security Settings: SSH Keys** after pressing the **"Add SSH Key"** button:

```
cat ~/.ssh/id_rsa.pub | pbcopy
```

Once this has been performed, please test to see if you can perform git operations. If this still does not work, check your configured git remote URL's to ensure that "master" is pointing to the correct Bitbucket Cloud workspace location where you have configured this SSH key:

```

git remote -vvv
```

If you have any further questions, please feel free to reach out. We will need to open a ticket for you if this is the case as this may require sharing sensitive information which is not suited for a public forum.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud

git