Suddenly access to the company's repositories disappeared only for me
Asked by ??????:

I suddenly lost access to all of the company's repositories from the **command line.**   
**In the browser, I have access to all repositories** .  
But any action from the command line results in the response: "*the requested repository either does not exist or you do not have access. if you believe this repository exists and you have access, make sure you're authenticated.*"

<br />

<br />

I have set up SSH key in my profile for access to repo from command line  
The SSH key has not been changed.

SSH auth is successfull:

ssh -T git@bitbucket.org  
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled

<br />

<br />

On Friday, I could work with the repositories from the command line, but today I cannot.

<br />

Now I have to switch all repositories to HTTPS authorization and change the origin everywhere, but it is inconvenient and time-consuming, and requires authentication and an application password for each repository in PHPStorm and in command line  


Answers:
author: ??????
body: ? ssh -vvv -t bitbucket.org  
OpenSSH_8.4p1, OpenSSL 1.1.1h 22 Sep 2020  
debug1: Reading configuration data /c/Users/laris/.ssh/config  
debug1: /c/Users/laris/.ssh/config line 17: Applying options for bitbucket.org  
debug1: Reading configuration data /etc/ssh/ssh_config  
debug3: expanded UserKnownHostsFile '\~/.ssh/known_hosts' -\> '/c/Users/laris/.ssh/known_hosts'  
debug3: expanded UserKnownHostsFile '\~/.ssh/known_hosts2' -\> '/c/Users/laris/.ssh/known_hosts2'  
debug2: resolving "bitbucket.org" port 22  
debug2: ssh_connect_direct  
debug1: Connecting to bitbucket.org \[18.234.32.155\] port 22.  
debug1: Connection established.  
debug1: identity file /c/Users/laris/.ssh/bitbucket type 3  
debug1: identity file /c/Users/laris/.ssh/bitbucket-cert type -1  
debug1: Local version string SSH-2.0-OpenSSH_8.4  
debug1: Remote protocol version 2.0, remote software version conker_c629078b71 b6d20feba4df  
debug1: no match: conker_c629078b71 b6d20feba4df  
debug2: fd 3 setting O_NONBLOCK  
debug1: Authenticating to bitbucket.org:22 as 'lmoroz'  
debug3: hostkeys_foreach: reading file "/c/Users/laris/.ssh/known_hosts"  
debug3: record_hostkey: found key type RSA in file /c/Users/laris/.ssh/known_hosts:1  
debug3: load_hostkeys: loaded 1 keys from bitbucket.org  
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa  
debug3: send packet: type 20  
debug1: SSH2_MSG_KEXINIT sent  
debug3: receive packet: type 20  
debug1: SSH2_MSG_KEXINIT received  
debug2: local client KEXINIT proposal  
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c  
debug2: host key algorithms: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com  
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc  
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc  
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1  
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1  
debug2: compression ctos: none,zlib@openssh.com,zlib  
debug2: compression stoc: none,zlib@openssh.com,zlib  
debug2: languages ctos:  
debug2: languages stoc:  
debug2: first_kex_follows 0  
debug2: reserved 0  
debug2: peer server KEXINIT proposal  
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-s  
debug2: host key algorithms: ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ssh-ed25519,ecdsa-sha2-nistp256  
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com  
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com  
debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96  
debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha1-96  
debug2: compression ctos: none  
debug2: compression stoc: none  
debug2: languages ctos:  
debug2: languages stoc:  
debug2: first_kex_follows 0  
debug2: reserved 0  
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  
debug3: send packet: type 30  
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY  
debug3: receive packet: type 31  
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A  
debug3: hostkeys_foreach: reading file "/c/Users/laris/.ssh/known_hosts"  
debug3: record_hostkey: found key type RSA in file /c/Users/laris/.ssh/known_hosts:1  
debug3: load_hostkeys: loaded 1 keys from bitbucket.org  
debug3: hostkeys_foreach: reading file "/c/Users/laris/.ssh/known_hosts"  
debug3: record_hostkey: found key type RSA in file /c/Users/laris/.ssh/known_hosts:57  
debug3: load_hostkeys: loaded 1 keys from 18.234.32.155  
debug1: Host 'bitbucket.org' is known and matches the RSA host key.  
debug1: Found key in /c/Users/laris/.ssh/known_hosts:1  
debug3: send packet: type 21  
debug2: set_newkeys: mode 1  
debug1: rekey out after 134217728 blocks  
debug1: SSH2_MSG_NEWKEYS sent  
debug1: expecting SSH2_MSG_NEWKEYS  
debug3: receive packet: type 21  
debug1: SSH2_MSG_NEWKEYS received  
debug2: set_newkeys: mode 0  
debug1: rekey in after 134217728 blocks  
debug1: Will attempt key: /c/Users/laris/.ssh/bitbucket ED25519 SHA256:sOBgbqFTFjmG0ntuG28myCDv/HP2aTwlxK9+94vJ7bw explicit  
debug2: pubkey_prepare: done  
debug3: send packet: type 5  
debug3: receive packet: type 7  
debug1: SSH2_MSG_EXT_INFO received  
debug1: kex_input_ext_info: server-sig-algs=\<ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-256,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa,rsa-sha2-512,ecdsa-sha2-nistp384,ssh-dss-cert-v01@openssh.com\>  
debug3: receive packet: type 6  
debug2: service_accept: ssh-userauth  
debug1: SSH2_MSG_SERVICE_ACCEPT received  
debug3: send packet: type 50  
debug3: receive packet: type 51  
debug1: Authentications that can continue: publickey  
debug3: start over, passed a different list publickey  
debug3: preferred publickey,keyboard-interactive,password  
debug3: authmethod_lookup publickey  
debug3: remaining preferred: keyboard-interactive,password  
debug3: authmethod_is_enabled publickey  
debug1: Next authentication method: publickey  
debug1: Offering public key: /c/Users/laris/.ssh/bitbucket ED25519 SHA256:sOBgbqFTFjmG0ntuG28myCDv/HP2aTwlxK9+94vJ7bw explicit  
debug3: send packet: type 50  
debug2: we sent a publickey packet, wait for reply  
debug3: receive packet: type 60  
debug1: Server accepts key: /c/Users/laris/.ssh/bitbucket ED25519 SHA256:sOBgbqFTFjmG0ntuG28myCDv/HP2aTwlxK9+94vJ7bw explicit  
debug3: sign_and_send_pubkey: ED25519 SHA256:sOBgbqFTFjmG0ntuG28myCDv/HP2aTwlxK9+94vJ7bw  
debug3: sign_and_send_pubkey: signing using ssh-ed25519 SHA256:sOBgbqFTFjmG0ntuG28myCDv/HP2aTwlxK9+94vJ7bw  
debug3: send packet: type 50  
debug3: receive packet: type 52  
debug1: Authentication succeeded (publickey).  
Authenticated to bitbucket.org (\[18.234.32.155\]:22).  
debug1: channel 0: new \[client-session\]  
debug3: ssh_session2_open: channel_new: 0  
debug2: channel 0: send open  
debug3: send packet: type 90  
debug1: Entering interactive session.  
debug1: pledge: network  
debug3: receive packet: type 80  
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0  
debug3: receive packet: type 91  
debug2: channel_input_open_confirmation: channel 0: callback start  
debug2: fd 3 setting TCP_NODELAY  
debug3: ssh_packet_set_tos: set IP_TOS 0x48  
debug2: client_session2_setup: id 0  
debug2: channel 0: request pty-req confirm 1  
debug3: send packet: type 98  
debug2: channel 0: request shell confirm 1  
debug3: send packet: type 98  
debug2: channel_input_open_confirmation: channel 0: callback done  
debug2: channel 0: open confirm rwindow 2097152 rmax 32768  
debug3: receive packet: type 100  
debug2: channel_input_status_confirm: type 100 id 0  
PTY allocation request failed on channel 0

comments: author: Patrik S
body: Hello [@??????](/t5/user/viewprofilepage/user-id/5146245) and welcome to Atlassian Community!

Thank you very much for sharing the verbose SSH logs. From your test results, the SSH key being used is indeed being recognized by Bitbucket (the authentication succeeded), but that does not necessarily mean that the key has the authorization to perform the operation in the repository you are receiving the error.

As you mentioned the key was added to your profile (Personal Settings \> SSH Keys), the key will provide you the same level of access to repositories as your account has.

From the logs I see the key currently being used by ssh is in the path **c/Users/laris/.ssh/bitbucket**. Could you please confirm if this is indeed the correct key to which the corresponding public key was added to your Bitbucket profile?

If that is not the correct key, you can create a file named **config**under the folder \~/.ssh/ with the following content :

```
Host bitbucket.org
     HostName bitbucket.org
     User git
     IdentityFile ~/.ssh/<name of your ssh private key>
     IdentitiesOnly yes
```

This will instruct SSH to use the key in the path provided on **IdentityFile** option. You can then confirm from the verbose logs if the correct key is being used.

Thank you, [@??????](/t5/user/viewprofilepage/user-id/5146245) !

Patrik S


author: ??????
body: [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) Thank you, I didn't have this section in \~/.ssh/config and everything was working until the day before yesterday. Now I added these lines and everything works again.


Tags: bitbucket-cloud

cloud

ssh