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)
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.