i have keys, and use them successfully. today i created a new repo, and only for this one,
with any git command i get this nasty message:
git clone git@gitlab.com:username/reponame.git store
Cloning into ‘store’…
load pubkey “/c/Users/username/.ssh/id_rsa”: invalid format
Load key “/c/Users/username/.ssh/id_rsa”: invalid format git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What could be the reason?
just for testing, went to some other repo on gitlab, everything works. commit, push, pull…
mystery.
load pubkey “/c/Users/username/.ssh/id_rsa” did you double check if you have an actual pub key which should be in .ssh/id_rsa.pub with proper permissions?
What happens when you run git clone https://gitlab.com/username/reponame store instead of git clone git@gitlab.com:username/reponame.git store ?
Thanks @alhemicar!
So I do have in that location id_rsa and id_rsa.ppk, but they are probably bad, from previous attempt.
(i made them with puttygen, it didn’t work, gitlab did not accept it)
The correct pair (i created using git bash) has different names: git-lab, and git-lab.pub
the .pub is uploaded to gitlab and it works well for all other repos.
just this one is looking for id_rsa, which is there, but we know it’s bad.
how do i tell it to use the correct key?
more answers to @alhemicar:
when i try this:
git clone https://gitlab.com/username/reponame.git , it works!
why did i even try with git@gitlab… ? just because that is written in the ‘command line instructions’ after you create an empty repo.
so basically it is solved. all i have to do is use the right command.
In case it keeps happening for future repos or you want to try and fix this issue properly you should make sure that your ssh config was set correctly in ~/.ssh/config (if you have the config) and it’s pointing the path to the working set of keys.
Alternatively add the working ssh file using ssh-add .