0

I generated ssh key pair on Windows 10 added private key to ssh-add client added public key to Bitbucket.

I run ssh -T git@bitbucket.org to check that everything is ok and have next output

logged in as myusername
You can use git or hg to connect to Bitbucket. Shell access is disabled

I try to clone a repository with ssh git clone git@bitbucket.org:myusername/test.git and have authentication issue

Cloning into 'test'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

Any ideas what can be a problem? Only one idea, when generating ssh keypair I saved it to .ssh folder but wrote different file name. ssh-add -l shows that the key is loaded

2048 SHA256:xxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxx C:\......\.ssh\id_bitbucket_rsa (RSA)
Vitalii
  • 10,091
  • 18
  • 83
  • 151

1 Answers1

0

With a help of this answer I found that if we use custom ssh key pair name we need to add it to the ssh configuration of git.

After I added

AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_bitbucket_rsa 

to c:\Program Files\Git\etc\ssh\ I could clone that repository.

Vitalii
  • 10,091
  • 18
  • 83
  • 151