Reputation: 699
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
Then git pull succeed.
Config:
How to fix this?
Thank you in advance!
Upvotes: 1
Views: 171
Reputation: 1325017
If the authentication succeeds, but the Git repository access fails (on Azure), then you need to double check the URL used.
It should be:
git ls-remote MyAzureAlias:<me>/<myrepo>
Mak sure the case (lower/uper) is correct
Upvotes: 0