Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot read from repository with publickey

Martin Fuhrer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 7, 2022

I have setup my personal account as a member of a workspace. I can browse the repos in the workspace within the browser. I also added an SSH key to my personal account. Running "ssh -v git@bitbucket.org" works and says something like "You can use git to connect to Bitbucket." But when I try to clone the repo I get the error "git@bitbucket.org: Permission denied (publickey)".

Accessing the same repo from another account (obviously with a different SSH key) works without any problem.

Do you have any ideas?

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2022

Hi @Martin Fuhrer

Welcome to the community.

To make sure your SSH key is in use, would it be possible for you to add it to your SSH agent?

eval $(ssh-agent)
ssh-add <Private SSH key location>

Once done, try to clone again.

If the issue still persists, you can try to enforce your environment to use a specific SSH key identity by adding the configuration below in your SSH config file.

Host bitbucket.org
  HostName bitbucket.org
  IdentityFile <Private SSH key location>

If you don't have the SSH config file yet, you can create it first:

vim ~/.ssh/config
chmod 600 ~/.ssh/config

Hope it helps and let me know how it goes.

Regards,
Mark C

Martin Fuhrer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 30, 2022

Hi Mark,

Sorry for late answer, the move to bitbucket cloud has been postponed for some time. But now I'm ready to tackle it again.

Meanwhile I also found the problem. I had my .ssh folder in my Windows home folder, but git bash was using a different folder as home. After moving the keys there everything worked fine.

Like Mark C likes this
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2022

No worries at all @Martin Fuhrer

Glad to know that after moving your keys, everything worked fine.

Do let me know if you have further questions that I can help with.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events