problem with ssh authentication
Asked by pcrooker:

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| I recently joined Jira to my primary bitbucket repository. I now find my ssh keys for the repository are missing. I added one, it authenticates as per the 'ssh -T git@bitbucket' test, yet I can't push any updates, I get an 'unauthorized' response.This appears to be exactly like the previous question: "Repository access is forbidden, but the SSH key authentication seems to succeed." I added the info to the ssh config file per the solution, but get the same result.Running ssh with -v I see that I am authenticated, yet I still get the unauthorized response. I am admin for the repository: ``` debug1: Next authentication method: publickey debug1: Offering public key: /home/pcrooker/.ssh/id_ecdsa ECDSA SHA256:Vq3W6YpyH6B7lLHjiNFKcNxed4nGlKemO+MLz9Ng/O4 explicit agent debug1: Server accepts key: /home/pcrooker/.ssh/id_ecdsa ECDSA SHA256:Vq3W6YpyH6B7lLHjiNFKcNxed4nGlKemO+MLz9Ng/O4 explicit agent debug1: Authentication succeeded (publickey). Authenticated to bitbucket.org ([104.192.141.1]:22). debug1: channel 0: new [client-session] debug1: Entering interactive session. /snip debug1: Sending command: git-receive-pack 'pcrooker/wikibotanica.git' debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 Unauthorized ``` I have been regularly pushing updates regularly until this happened. I'm stuck - can anyone help? thanks, Phil |


Answers:
author: Mark C
body: Hi [@pcrooker](/t5/user/viewprofilepage/user-id/4914489)

Welcome to the community.

Based on the error message you've got which is "Repository access is forbidden", it seems you're pushing to a repository with an access key.  

Would it be possible for you to confirm if you're using an SSH key that is added under your **Repository settings \> Access keys** ?  
If yes, it is expected that you won't be able to push to the repository with the SSH key added as an access key because [Access keys](https://support.atlassian.com/bitbucket-cloud/docs/add-access-keys/) only grant read-only access to a public or private repository.  
Hence, you can't push using that SSH key.

If you'd like to be able to push using the SSH key, you'd need to add the SSH key under your Bitbucket Cloud account's level SSH key settings instead.  
You can check this documentation for more information: [Set up an SSH key](https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/)

Hope it helps and let me know how it goes.

Regards,  
Mark C

comments: author: pcrooker
body: Thanks, Mark, yes that is it. I got mixed up between the two locations. Thanks again for the help.


Tags: bitbucket-cloud

cloud