SSH authentication not being recognized
Asked by Ryan Stapleton:

Hi,

I'm trying to switch remote git access to my repo from https to ssh, to avoid needing to use an app password, but I can't seem to read from the repo when I change the remote. I get a "The requested repository either does not exist or you do not have access." message. When I switch the remote back to use https, it connects fine:  

![Screen Shot 2022-02-21 at 2.39.28 PM.png](/t5/image/serverpage/image-id/184627i704AC4EDDAEEA181/image-size/large?v=v2&px=999 "Screen Shot 2022-02-21 at 2.39.28 PM.png")

I have referenced this documentation for creating an ssh key and I uploaded the new key to my bitbucket profile: <https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/>

I've referenced this page as well for changing a remote from https to ssh: <https://support.atlassian.com/bitbucket-cloud/docs/change-the-remote-url-to-your-repository/>

...and this troubleshooting page for help: <https://support.atlassian.com/bitbucket-cloud/docs/troubleshoot-ssh-issues/>

As mentioned in the documentation, I used the following command to check if I'm authenticated, it says that I am.

![Screen Shot 2022-02-21 at 2.38.37 PM.png](/t5/image/serverpage/image-id/184624i5C76F7D3EF5839B5/image-size/large?v=v2&px=999 "Screen Shot 2022-02-21 at 2.38.37 PM.png")

I'm not sure what authentication I'm failing when pulling/pushing. As far as I can tell, the remote ssh path is correct. I do use another ssh key for another git project for github, so I'm wondering if this is related to local macOS key management. Perhaps by default, the ssh key for my other project is being used. I confess I've never needed to use more than one key/profile before until this project, so I'm not sure how to configure that kind of setup, or even if it's the problem at all.

Any help or insight is appreciated, thank you.


Answers:
author: Ryan Stapleton
body: Ok I found the problem and fixed the issue. For those who may have a similar issue, the problem wasn't in access, it was in the path itself.

I was not the original creator of the project - I was given full admin access, but the project remains in ownership with the original developer (rice121 in the terminal snippets I provided).

The SSH path for remote access needs the workplace ID of the *current owner* of the project, not simply one who has all admin access/permissions as I do. I was trying to give both IDs but SSH path doesn't actually need my own in my case, thus creating a "repository does not exist" response.

So for SSH:

```
git@bitbucket.com:<workplace_ID_of_current_project_owner>/<repo_name>
```

This is different from HTTPS connection which needs both the user name and workspace ID as part of the path:

```
https://<your_username>@bitbucket.org/<workspace_ID>/<repo_name>.git
```

comments: author: Shailesh Gehlot
body: [@Ryan Stapleton](/t5/user/viewprofilepage/user-id/4769957) isn't workplace id is rice121 in your case?


author: Shailesh Gehlot
body: [@Ryan Stapleton](/t5/user/viewprofilepage/user-id/4769957) i mean when we clone the repo by ssh we just copy from bitbucket itself


author: Ryan Stapleton
body: Probably in most cases that will work fine.

My issue came from the fact that I was logging into another user's project (rice121). My own workspace ID is different. I had full admin access but not ownership of the repo. So my ssh path to this project needed to remove my own ID and only use rice121 as the \<workspace_ID\>.


author: Shailesh Gehlot
body: i am exactly facing the same issue :(


Tags: bitbucket-server

server