git ssh key for all git Accounts

Malisha Tharindu
1 min readJul 23, 2020
  1. Generate ssh Key with comment
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

2. Add agent

$ eval "$(ssh-agent -s)"

add the ssh id to agent

$ ssh-add -K ~/.ssh/id_rsa

3. Open .ssh/ config file

$ open ~/.ssh/config

If there no config file you have to create using the following command

Add following code in the ssh config file for all type host

Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa

4. Copy to add ssh key to your GitHub

pbcopy < ~/.ssh/id_rsa.pub

5. Check

ssh -T git@github.com

Done.

--

--

Malisha Tharindu

Entrepreneur | iOS Developer | Web Developer with more than 5 Years of Experience. Founder of Learn with Malisha