Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SSH key, clone & fetch works, push doesn't, unable to add key to my account

Stefaan Vandevelde August 17, 2019

Strange thing  :

I'm on a new Windows installation, working with openSSH, git for windows, vscode, sourcetree and tortoisegit.  

I set all git-related tools to use openSSH manager, created a new key pair and uploaded the public key to my bitbucket account.

When I create a new repository and clone it to my computer, no problem.  However, when pushing to the respository I get this error :

Unauthorized
fatal: Could not read from remote repository.

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

I checked the SSH key in my account and it isn't there anymore !  When I try to add it again, I get

Someone has already added that key as an access key to a repository.,

so not possible to add the key.  Yet, I can still clone and fetch using SSH, so it seems the key is accepted.

I know the easiest things is probably to just create a new key pair, but this is too strange to me not to mention it.  Seems like a security issue.  Right now, there's no key defined in my account but it is still possible to clone the repository over SSH ?

I tried the same thing with a purpose-created gitlab account and the same SSH key, and there everything works fine.

For reference, "ssh -T hg@bitbucket.org" returns

authenticated via a deploy key.

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

This deploy key has read access to the following repositories:
svdvk/dockertest
bruyland/csv-transformer

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2019

Hi Stefaan, welcome to the Community.

I've checked your Bitbucket Cloud account for this Atlassian account (the account you're using to access this forum is associated to the username s*********e) and I can see that there's an SSH key there, can you confirm is that the pair to the SSH key you have in your machine?

I've also checked the Bitbucket accounts that were listed in your message, and your current Bitbucket account is not one of them:

- svdvk/dockertest is another Bitbucket Cloud account that seems to be yours too
- bruyland/csv-transformer is a Team account 

So seems like you might have several Bitbucket accounts, and you're mixing the credentials. To solve this situation:

- Can you make sure you're using the right account, and that you have the right credentials?

- Can you check that you have the right permissions? (you need write permissions for pushing code)

Let us know!

Ana

Stefaan Vandevelde August 22, 2019

Hi Ana,

Things work fine now. The problem was that git was using a different SSH setup than Windows due to installation of toirtoiseGit and some wrong setup.  Took me some time to figure out, but it's solved now.

Thanks for looking into this.  We're just starting with Jira, bitbucket and confluence and it can be overwhelming at times.

Stefaan

Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2019

Hi @Stefaan Vandevelde , no worries, I'm glad we could guide you in the right direction :) 

If you need anything else, let us know!

Best regards,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events