OP says he uses ssh-keygen not some ssh-rsa command - there is no command called that on my system, but it might all come down to you using some inferior OS to us (I use Linux, more specifically Debian Bookworm - and technically these things depends on the ssh-client not the OS).
ssh-keygen has never created a file called <anything>.file when I have run it (and I guess I created my first SSH keys more than 25 years ago), and the generated <something>.pub file only contains one key. So what you’re writing is strange (and unusable for anyone using sane tools)
@mandarvaze Have you tried shorter keys? To see if that error is trying to tell you that your key is too long? (Yes, that is a silly restriction, but some websites do silly things, and GitLab is not above that level)
Or just including/excluding the ssh-rsa part at the beginning of the key so it’s possible/easy to determine what kind of key it is.
I have uploaded an SSH key to my account on gitlab.com, but it was several years ago, and I simply don’t remember how long that is, or whether I had to include/exclude the ssh-rsa part.
If none of my simple suggestions help, maybe you can share it here (it’s a public key, not really supposed to be secret, but in case you’re doing something wrong and uploading the private key, generate a new, see it rejected, and upload it here).
Hey, I made a typo above. The .pub file has the public key.
Anyway, I don’t seem to see this documented elsewhere, but you need to copy the generated id_rsa.file and id_rsa.pub files into your .ssh folder on windows.
After that, cloning ssh url will ask for a passphrase, instead of the git.etc password.
Enter the passphrase you created while generating the keys.
Here are the complete steps, going from 0 to successfully cloning which I can’t seem to find online elsewhere:
In cmd, use the following command to generate keys with your company email etc:
ssh-keygen -o -t rsa -C “ssh-keygen@mcnz.com”. Keep name as id_rsa when prompted.
Copy files to .ssh folder on windowsuser/.ssh. Eg if your windows name is mandar, it’s <<C:\Users\mandar\ .ssh>>
Copy key from id_rsa.pub file. Not from the id_rsa.File file!
Clone ssh url only, from gitlab in Visual Studio, provide (3) to field.