I had requested access to a Git repository and it was granted after I gave my public and private keys.
( generated using the common method ssh-keygen -t rsa
which gave me :
<user> @ <hostname> : ~/.ssh $ > ll
total 20K
-rw-------. 1 <user> 1.7K Mar 02 10:14 id_rsa
-rw-r--r--. 1 <user> 407 Mar 02 10:14 id_rsa.pub
-rw-r--r--. 1 <user> 1.3K Mar 01 14:25 known_hosts
)
However, I accidentally deleted my home directory. Fortunately, I had the backup of all my important files and so, it was not much of a hassle to recover those.
But, trying to clone the Git repository again using the old public and private key, I could not. The Git asked me for a password just like it would treat any non-authorised users.
So, I then had to request the access again using my current public and private keys.
Upon comparison, I found out that the new keys are in fact different from the first ones.
So, my question is,
- Why does the public and private key change for a user in the same machine?
- In continuation of that question, why can't I use my old public and private key to access a repository when nothing else has changed?
- Will the keys change if I create them again using
ssh-keygen -t rsa
?
I can provide more info if needed.