Key must be Base64 encoded with OpenSSH format and RSA type. Valid keys will start with ssh-rsa

Error - Key must be Base64 encoded with OpenSSH format and RSA type. Valid keys will start with ssh-rsa

If you get the below error following Azure/Microsoft documentation on authenticating keys with ssh

ssh-keygen -C "email"
Error - Key must be Base64 encoded with OpenSSH format and RSA type. Valid keys will start with ssh-rsa

Follow the below steps to quickly generate ssh key

ssh-keygen -C "email" -t rsa

You can hit enter for all the prompts or customize by providing new keyname and location.

Once you get a randomart image, like below

+---[RSA 3072]----+
|                 |
|    .            |
|   E .  .        |
|  . -  . .       |
|++oo    S        |
|@=oo. o..        |
|*B=. =.=         |
|B*+o o* =.       |
|%=+=*o.+o        |
+----[SHA256]-----+

Type the below command in terminal

vi id_rsa.pub

It will look something like this

ssh-rsa AAAAC1yc2EAAAADAQABAAABgQDK5XiisCX6QGrgI/5oDEANbqR05iDz9DH10d//iWOCYbPd0UTUUhhO5zQKxa4das565Y7qOByq5xOHBea+KSUeIpwsqBBQm0J9uWj3+D4DoALXalhPKMYl5fRthUVdqUelmaLkCVdPv+JnDl7RSVqlsaJYjVkLiB450/hpGBx8pmci5QWBuY0nDxZCIZCQwTZpZkJKQTF8kRQbV1fj35CohbSUmF/vQ7N/P++xiTExfktbRnXnuuBZ41XeoBFiYryo4i47y0hPaZAF69tmIMS8vcqfMi0MJWB0NJh4AoGbFfYyoo96UyT42cN9ZdlELqG/FNltzUKBMrjyVMCZLlh99m0+OWue+wGlmzrSrqx5fY5VmrECw/z0uVKDvy17jK/P3etrjKUwJbh48+4A0m73bB7dDH2fHwLGy69710UAlOsisfN7r7BvQh53Z3uZDFZeZgiNztVe6WpdTDDKjEFF0lVXIdAGHWj28Aoh77naKEUSKsKS/rFXzj/a0= email

Final steps

  1. Copy similar content from your terminal
  2. Go to User Settings in azure devops
  3. Go to ssh public keys
  4. Click Add
  5. Paste your public key there
  6. Now clone your repo. It should work!