Gitlab On-premise installation SSH issue load pubkey invalid format

Hello,

I am currently almost on this issue for 5 - 6 hours but for some reason I cannot see the issue nor can I resolve it… When I try to issue the command ‘git pull’ I get the following error:

This is frustrating me as I have the keys properly configured/installed. I even created new keys to see if that would work but no luck. I also added the -----BEGIN RSA PRIVATE KEY----- within the private key file but also this gives me no luck :(…
Which also gives me this error, which I find a bit strange and couldnt find any extra explanation on:

Also why does it search for the pubkey in /root/.ssh/id_rsa (Which is a private key) and then again for the private key it searches for the same path. Could this be the issue?

If someone could help me with this, I would be very grateful!

EDIT:

I found the solution, instead of using PuTTYGen try the Linux/Git CLI and generate the Public/Private keys through there via: ssh-keygen -b (2048/4096).

Do you have any configuration applied under your user’s ~/.ssh/config file that overrides location or filenames of keys?

Also, do you actually have the public key at ~/.ssh/id_rsa.pub?

If it broke after a recent OS upgrade, this article may also be relevant: https://blog.hqcodeshop.fi/archives/482-OpenSSH-8.3-client-fails-with-load-pubkey-invalid-format.html

Hello @hchouraria

Thanks for your reply, apparently I found the issue myself after some more digging and using the Linux/Git Bash CLI to generate the SSH keys.

So I found this solution:
Using PuTTyGen will not help in this case, because apparently Gitlab has something against it or the keys are simply different from the general Linux/Git Bash generated keys via ssh-keygen -b 2048/4096.
Is there a reason for this? That using PuTTyGen keys won’t work?

So the solution to this, like written above, using the Linux/Git CLI and generate the keys there via ssh-keygen -b (2048/4096)

GitLab (the service) doesn’t yet come into play here - the failure is occurring during OpenSSH tools validating the requisites required to make a connection. The tool is not finding, or accepting, the public key format file that PuTTYgen has created.

This answer on StackOverflow regarding the default behavior of PuTTYgen may be relevant to your situation, perhaps.