`ssh -T` to VSTS(Azure Devops) authenticates successfully, but `git clone` fails
In my case, adding IdentitiesOnly yes
to the ~/.ssh/config
file for the VSO host did the trick.
You need to force the client to use specific private key, otherwise it uses the default one.
To check which private key file used for a host, you can run
ssh -v [host(e.g. [email protected])]
One way is that you can configure it in the config file. (My steps for windows)
- Run
touch .ssh/config
if there isn’t config file in .ssh folder - Open config file
code:
Host xx.visualstudio.com
IdentityFile /c/Users/xx/.ssh/id_vsts
- Open new command line and run
Git clone
command
Another way is that, you can run ssh -i /path/to/id_rsa [email protected]
command.
More information, you can refer to this article: Force SSH Client To Use Given Private Key (identity file)