Konrad
Konrad

Reputation: 123

Error when generating an SSH key with Git: "no such file"

I continually run into the same error when I try to generate an SSH key:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/konrad/.ssh/id_rsa):

Here I press enter.

Could not create directory '/home/konrad/.ssh'

Then I enter my passphrases.

open /home/konrad/.ssh/id_rsa failed: No such file or directory.
Saving the key failed: /home/konrad/.ssh/id_rsa.

I've tried re-installing Git multiple times, but that hasn't helped. I think it may be because C:/Users/Konrad should be the default directory, rather than /home. Any advice?

Upvotes: 12

Views: 19099

Answers (2)

Sean
Sean

Reputation: 10206

Drop to a command line and type:

ssh-keygen -t rsa

And follow the prompts there. I'm pretty sure git's doing exactly that under the hood for you.

Upvotes: 4

VonC
VonC

Reputation: 1324228

On msysgit, you need first to set the user environment variable HOME (which isn't set by default in Windows).

HOME can be set to any directory you want, you only have to make sure you have the right to write in it (and that the directory exists and a .ssh under it exists too).

Upvotes: 9

Related Questions