Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git looking for my SSH key in the wrong location

I've been having a bit of a head ache with trying to pull down a repository held in Gitlab. This is all done in Windows 8.1 on a Ubuntu VM by the way if that helps. I've added my public key in Gitlab and added my private key to ssh-agent ... all seems correct.

When I try and do a git pull this is where I run in to issues. It seems to me that Git is simply looking in the wrong location, my private key is stored in c/Users/Neil/.ssh but it seems as if git is looking in c/Users/Neil/.ssh/342/200/217 ...

C:\Users\Neil\code\homestead>git pull
no such identity: /c/Users/Neil/.ssh/id_rsa\342\200\217: No such file or directory
[email protected]'s password:

I've no idea why git would be looking there or am I thinking wrong about this? Can anyone shed some light on things for me?

like image 398
Neil Kelsey Avatar asked Feb 28 '15 17:02

Neil Kelsey


1 Answers

GitLab itself isn't looking for your ssh keys: as a client, you are using ssh to contact GitLab, which means only openssh is looking for those keys.

It (openssh) will find them in:

  • %HOME%\.ssh (so check what the environment variable HOME is set to)
  • %HOME%\.ssh\config (where an IdentifiyFile directive can set a custom path for the ssh private key, so check if you have a .ssh/config file)

The OP Neil Kelsey confirms in the comments that the %HOME%\.ssh\config was causing some kind of interference.

And the push url seemed still referencing an https url.
A simple git remote set-url --push origin <ssh/url> fixed that.

like image 174
VonC Avatar answered Sep 22 '22 17:09

VonC