FilBot3
FilBot3

Reputation: 3698

Git not using SSH Key to authenticate to Azure DevOps

I recently switched to a new install of Fedora 33 Silverblue running a toolbox. This also happened outside of the toolbox as well. I generated an SSH key using the following command

ssh-keygen -t rsa -b 4096 -C filbot@fenix

Then I uploaded it to Azure DevOps under my account. However, I cannot clone anything from Azure DevOps with the following ~/.ssh/config:

⬢[filbot@toolbox ~]$ cat ~/.ssh/config 
# SSH Configuration File
Host ssh.dev.azure.com
  HostName ssh.dev.azure.com
  User git
  IdentityFile /var/home/filbot/.ssh/id_rsa
  IdentitiesOnly yes
Host vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  User git
  IdentityFile /var/home/filbot/.ssh/id_rsa
  IdentitiesOnly yes

Then I ran these git clone commands with the following result:

⬢[filbot@toolbox ~]$ git clone [email protected]:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
[email protected]'s password: 

⬢[filbot@toolbox ~]$ GIT_SSH_COMMAND=ssh git clone [email protected]:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
[email protected]'s password: 

⬢[filbot@toolbox ~]$ ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address '20.37.158.9' to the list of known hosts.
[email protected]'s password: 

⬢[filbot@toolbox ~]$ ssh -i ~/.ssh/id_rsa -T [email protected]
[email protected]'s password: 

It seems that Git is not respecting or even using the ssh config in my home directory like it did before or in other older installs of Fedora or Pop!_OS. I don't understand why it's doing this now, and how to get the information to figure this out more.

Upvotes: 2

Views: 4717

Answers (3)

Matt S.
Matt S.

Reputation: 116

I had the exact same issue and found a solution here:

Fedora 33 git pull or clone no longer working and/or ssh key no longer recognized

Basically, in your ~/.ssh/config file, under each Host section, add PubkeyAcceptedKeyTypes ssh-rsa.

Host ssh.dev.azure.com
  HostName ssh.dev.azure.com
  User git
  IdentityFile /var/home/filbot/.ssh/id_rsa
  IdentitiesOnly yes
  PubkeyAcceptedKeyTypes ssh-rsa

Upvotes: 8

FilBot3
FilBot3

Reputation: 3698

It seems to be a Fedora 33 thing. I used a Fedora 32 Toolbox and Git worked as expected.

➜  ~ toolbox create --release f32
Image required to create toolbox container.
Download registry.fedoraproject.org/f32/fedora-toolbox:32 (500MB)? [y/N]: y
Created container: fedora-toolbox-32
Enter with: toolbox enter --release 32
➜  ~ toolbox enter --release 32
⬢[filbot@toolbox ~]$ git clone -v [email protected]:v3/$ORG/$PROJ/Developer.dudleyp.cs_pipeline_tasks
Cloning into 'Developer.dudleyp.cs_pipeline_tasks'...
remote: Azure Repos
remote: Found 45 objects to send. (88 ms)
Receiving objects: 100% (45/45), 77.83 KiB | 25.94 MiB/s, done.
Resolving deltas: 100% (14/14), done.

Upvotes: 0

m8usz
m8usz

Reputation: 466

Run ssh in debug mode, with -v. It will output the whole process running in the background. In the output, it will mention what method of authentication it's using and why.

Upvotes: 0

Related Questions