This is something that I do all the time but I always get it wrong....
-
Navigate to
~/.ssh/
-
Run below command and follow the prompt
ssh-keygen -t rsa
- Make sure the permission are as follow
- .ssh directory is 700 (drwx------)
- public key is 644 (-rw-r--r--)
- private key is 600 (-rw-------)
NOTE: if you are using git-bash on windows and chmod doesnt work, then read this and install cygwin to chmod
NOTE NOTE: Host * should always be the last entry as a catchall
- Create config file in ~/.ssh/ . A sample config should look something like this:
Host *
User user123
IdentityFile ~/.ssh/id_rsa