Victor Zakharov
Victor Zakharov

Reputation: 26414

Configure SSH for Git - cannot find id_rsa.pub after creating a key

I am configuring Git to be used with Assembla's remote repository, but I think the same workflow is used with any remote repository, so my question must have a simple generic answer.

Following the docs:

In Windows, the key pair will appear at C:\Users\name\.ssh by default. In Mac and Linux, it will be in ~/.ssh hidden directory.

I am on Windows, so I looked in my user folder, no .ssh folder found (notice I used /ah to include hidden files):

C:\Users\Victor>dir /ah
 Volume in drive C has no label.
 Volume Serial Number is XXXX-XXXX

 Directory of C:\Users\Victor

09/19/2014  06:20 PM    <DIR>          AppData
09/19/2014  06:20 PM    <JUNCTION>     Application Data [C:\Users\Victor\AppData
09/19/2014  06:20 PM    <JUNCTION>     Cookies [C:\Users\Victor\AppData\Roaming\
09/19/2014  06:20 PM    <JUNCTION>     Local Settings [C:\Users\Victor\AppData\L
09/19/2014  06:20 PM    <JUNCTION>     My Documents [C:\Users\Victor\Documents]
09/19/2014  06:20 PM    <JUNCTION>     NetHood [C:\Users\Victor\AppData\Roaming\
09/21/2014  06:39 PM           786,432 NTUSER.DAT
09/21/2014  06:39 PM           262,144 ntuser.dat.LOG1
09/19/2014  06:20 PM                 0 ntuser.dat.LOG2
09/19/2014  06:22 PM            65,536 NTUSER.DAT{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx
09/19/2014  06:22 PM           524,288 NTUSER.DAT{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx
09/19/2014  06:22 PM           524,288 NTUSER.DAT{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx
09/19/2014  06:20 PM                20 ntuser.ini
09/19/2014  06:20 PM    <JUNCTION>     PrintHood [C:\Users\Victor\AppData\Roamin
09/19/2014  06:20 PM    <JUNCTION>     Recent [C:\Users\Victor\AppData\Roaming\M
09/19/2014  06:20 PM    <JUNCTION>     SendTo [C:\Users\Victor\AppData\Roaming\M
09/19/2014  06:20 PM    <JUNCTION>     Start Menu [C:\Users\Victor\AppData\Roami
09/19/2014  06:20 PM    <JUNCTION>     Templates [C:\Users\Victor\AppData\Roamin

When I tried to recreate the key, it says one already exists.

C:\Program Files (x86)\Git\bin>ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa): neolisk
neolisk already exists.
Overwrite (y/n)? n

So where is it then? As a side note, this whole concept of having to generate keys is new to me, as I am coming from SVN world, where authentication is transparent with no client side config needed except for entering user name and password. If there is an option to configure Git without keys, I would appreciate if you could share how to do it.

This may not be relevant to my question, but to keep this in context of software development, I am using Visual Studio 2008 with Git Source Control provider from Codeplex and git extensions. I did not find a way to set this up inside the IDE, this is why I am playing with command line here. Local commits were working fine, this came up when I decided to link with remote. If there is a way to configure it within the IDE, please share your thoughts.

Upvotes: 2

Views: 7824

Answers (3)

Arshehremen
Arshehremen

Reputation: 26

Enter file in which to save the key (//.ssh/id_rsa):

just press Enter without enter your filename

Upvotes: 0

Victor Zakharov
Victor Zakharov

Reputation: 26414

For completeness, here is the output log from a successful run of ssh-keygen command (same results when running inside git bash or command prompt):

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Victor/.ssh/id_rsa):
/c/Users/Victor/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Victor/.ssh/id_rsa.
Your public key has been saved in /c/Users/Victor/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx [email protected]

Upvotes: 0

VonC
VonC

Reputation: 1323115

First, make sure the environment variable HOME is defined to C:\Users\Victor

Second, when you see Enter file in which to save the key (/C/Users.Victor/.ssh/id_rsa):, simply hit return, and it will create the right files.

I prefer using Git in a cmd session, after launching git-cmd.bat, which does set HOME properly.

Upvotes: 1

Related Questions