Git saves SSH in local project repository not in C:\Users\user-name/.ssh/id_rsa

Viewed 30

I added a ssh key.

ssh-keygen -t rsa -b 4096 -C "my email"
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey
Enter passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved in testkey.
Your public key has been saved in testkey.pub.

I tried commands like ls -al ~/.ssh and cat ~/.ssh/id_rsa.pub to find it. Didn't help.
Than i created a .ssh folder in my user directory using mkdir ${HOME}/.ssh and tied to create another SSH key. I did it in VS Code so it told me

testkey already exists. 
Overwrite (y/n)?

Then i decided to cat testkey.pub and it returned me a key. Than i checked my local repo and found 2 files testkey and testkey.pub
So why it can't save in C:\Users\user-name/.ssh/id_rsa ?
I obviously don't want to store it my local project repo

I am still learning. Was watching Course about Git but got stuck on 22:00 with this problem

1 Answers

Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey

You entered filename without full path so ssh-keygen saves the keypair in the current directory. The answer should be

Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):C:\Users\user-name/.ssh/testkey

Or

C:
cd \Users\user-name\.ssh
ssh-keygen
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey
Related