Hi,
Before I've successfully pushed code to my remote BitBucket repository. Upon "git push" I've used a private password.
Now I've added a new ssh key to my personal settings for the same type of command. The response is "git@bitbucket.org: Permission denied (publickey)" and BitBucket settings indicate the public key is never used.
I've followed the steps in: https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/
- ssh-keygen -t ed25519 -b 4096 -C "{username@emaildomain.com}"
- ssh-add <ssh-private-key-name>
Testing by command "ssh -T git@bitbucket.org" also gives response "git@bitbucket.org: Permission denied (publickey)"
Thanks for help,
Mikael
Hello @Mikael Lundin and welcome to the Community!
It might be the case that you have multiple keys currently added to your agent, so the agent is picking a different key other than the new one you have created.
You can use the following command to list all the ssh keys currently added to the agent:
ssh-add -l
and then delete from the agent the keys you don't want, leaving just the new key you have created :
ssh-add -d <path to the key to remove from the agent>
Once the only key in the agent is the new key you have created, you can try the git command again and check how it goes.
If it's still failing on the authentication, you can try to clone the repository while enabling verbose logs, so git will output in the logs what are the ssh keys that are being attempted:
GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git clone git@bitbucket.org:<workspace>/<repository>.git
If you want help troubleshooting the verbose logs, feel free to share them with us here (removing any sensitive information) and we can help you to identify what key(s) git is trying to use.
Thank you, @Mikael Lundin !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.