Search code examples
linuxubuntukeyssh-keysopenssh

How to know the SSH key's length?


How to know the SSH key's length?

I'm getting the following error for my git pull just recently,

$ git pull
> GitLab: Your SSH key must be at least 2048 bits.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

where everything had been working fine before.

Instead of guessing (or trial-n-error) which key is the culprit, is it possible to list all my SSH keys' length?

UPDATE:

  • Only git pull is giving me above error. I.e., my public key is still fine:

    $ ssh -T git@salsa.debian.org
    Welcome to GitLab, @myid-guest!
    
  • The ssh-keygen -lf might not be the answer, as I'm following https://docs.gitlab.com/ee/ssh/, who recommends to use ed25519 as default key, and who also instructs that, to generate a new ED25519 SSH key pair, do ssh-keygen -t ed25519 -C "email@example.com". However, my ssh-keygen -lf reports that

    $ ssh-keygen -lf id_ed25519.pub
    256 SHA256:PO2bk6B...
    

It is unlikely that the recommend ED25519 SSH key is only 256 bits long.


Solution

  • Can you try

    ssh-keygen -lf keygen.pub