Git SSH public key authentication failed with git on Azure DevOps

ID : 131336

viewed : 8

Tags : gitazure-devopsgit

Top 5 Answer for Git SSH public key authentication failed with git on Azure DevOps

vote vote

96

This worked for me

adding a config (a file named config) file in ~/.ssh/

and adding these lines

Host ssh.dev.azure.com   IdentityFile ~/.ssh/your_private_key   IdentitiesOnly yes 

This link by @wcoder helped

vote vote

90

Before this I had already tried the other answers, but nothing worked. At last, this article had the solution for me in Fedora.

Running ssh with the -v switch (ssh -v -T git@ssh.dev.azure.com) revealed this error:

debug1: send_pubkey_test: no mutual signature algorithm 

Workaround is to add this line to the client configuration file (~/.ssh/config):

PubkeyAcceptedKeyTypes +rsa-sha2-256,rsa-sha2-512 
vote vote

73

I believe @Schalton's comment is right: SSH validation is failing, so it prompts for the pass.

Had the same problem. "Solved it" by generating the key as the default value ('id_rsa') instead of using other names (tried other names and none of them worked).

[####@#### .ssh]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/guille/.ssh/id_rsa): id_rsa Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub. 

EDIT: As noted by @LHM the value default (no input needed) for the file in which to save the key is showed in parenthesis.

vote vote

66

I realize this question mentions powershell. However, with the title and tags people on other OS's may end up here, and there is a common problem with Azure Devops access from mac and linux.

To fix this for mac and linux, add IdentitiesOnly yes to ~/.ssh/config

This is a common problem for Azure Devops. Unfortunately I'm not certain why this fixes it.

vote vote

51

TL;DR: It turns out the path and filename shown in parenthesis (e.g./home/guille/.ssh/id_rsa) is a default value that can be accepted simply by leaving it blank and hitting Enter.


Extended Answer: I, too, had the same problem. I made the same mistake as @eltbus (attempting to name the file something myself), so his answer of sticking to the default of "id_rsa" was helpful to me. I also realized that when I generated the rsa key pair, I saved id_rsa.pub to the wrong folder. (Only entering id_rsa without a leading file path, can save it to a different folder.)

You can avoid both of my above mistakes if you simply hit Enter to accept the default file name and location, instead of typing in a path and/or file name.

Example:

[####@#### .ssh]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/guille/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub. 

Top 3 video Explaining Git SSH public key authentication failed with git on Azure DevOps

Related QUESTION?