Hello everyone I get this error when I tried to connect to another account in Bitbucket. If you also have multiple accounts in bitbucket, you will need to set up a configuration file for them.
There is official documentation on this: https://blog.developer.atlassian.com/different-ssh-keys-multiple-bitbucket-accounts/
There is a response from other users:
https://mcmap.net/q/259413/-how-to-maintain-multiple-bitbucket-accounts-with-multiple-ssh-keys-in-the-same-system
There are several steps to achieve this (for mac OS):
- First of all, create a key for each account
ssh-keygen -f ~/.ssh/username1 -C "username1"
, ssh-keygen -f ~/.ssh/username2 -C "username2"
- Edit the ~/.ssh/config file. If you don't have a config file, create one.
- Add an alias for each identity combination for example:
#username1
Host bitbucket.org-user1
HostName bitbucket.org
User git
IdentityFile ~/.ssh/username1
IdentitiesOnly yes
#username2
Host bitbucket.org-user2
HostName bitbucket.org
User git
IdentityFile ~/.ssh/username1
IdentitiesOnly yes
- Load each key into the appropriate Bitbucket account
- Сheck that ssh-agent is running
ps | grep ssh-agent
- Check current loaded keys
ssh-add -l
- If you don't see your keys, add each of them
ssh-add ~/.ssh/username1
, ssh-add ~/.ssh/username2
- Check current loaded keys again
ssh-add -l
Now you can work with bitbucket, authentication will be performed automatically