My ~/.ssh/config
Host MyAzureAlias
HostName ssh.myhostname.azure.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_azure_key
Host MyBitbucketAlias
HostName bitbucket.org
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_bitbucket_key
Then i run
ssh-add -K ~/.ssh/id_rsa_azure_key
ssh-add -K ~/.ssh/id_rsa_bitbucket_key
Then i opened webstorm and opened both projects. I made pull on bitbucket. Success. I made pull on azure and i got error: remote: Public key authentication failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Then i runssh -v MyAzureAlias
And in debug i got debug1: identity file /Users/myname/.ssh/id_rsa_azure_key
And at the end i got debug1: Authentication succeeded (publickey).
This means that my ~/.ssh/config for MyAzureAlias works fine.
Then i run ssh-add -l and it gave me my two keys.
Then i run eval "$(ssh-agent -s)" and then i run ssh-add -l again and it gave me no keys.
Then i run
- eval "$(ssh-agent -s)"
- ssh-add -K ~/.ssh/id_rsa_azure_key
Then git pull succeed.
Config:
- macOS Catalina 10.15.4.
- git version 2.24.1 (Apple Git-126)
- ssh -V OpenSSH_8.1p1, LibreSSL 2.7.3
How to fix this?
Thank you in advance!