TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

Multiple SSH Keys and Azure DevOps

April 4, 2022

This is an issue with Azure SSH keys on both Windows and macOS. If you have multiple SSH keysin the ~/.ssh folder, it'll try the first one only and if that one is not the one you use with Azure, it'll present you with an authentication failed error instead of trying the rest of the keys (as you'd normally expect with SSH)

If you have multiple keys saved in your .ssh folder or loaded with ssh-agent, Azure DevOps will try only the first one and if that's not the one for it then it'll fail with

code
remote: Public key authentication failed.
fatal: Could not read from remote repository.

or

code
remote: TF401019: The Git repository with name or identifier Auth does not exist or you do not have permissions for the operation you are attempting.
fatal: Could not read from remote repository.

Solution is adding a Host entry to your .ssh/config specifying the key you want to use ref

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