SSH key will not be constantly added to my keychain

I tried the following:

ssh-add -K ~/.ssh/id_rsa 

This seems to work until I end my terminal session, but then again get a hint for my passphrase with a new session.

Here is what I see after running the command above:

 Identity added: /Users/xxx/.ssh/id_rsa (/Users/xxx/.ssh/id_rsa) 

I am on iTerm2 Build 3.0.13 with zsh: stable 5.3.1 , running on macOS Sierra 10.12.2

+5
source share
2 answers

One solution is to add the command to the ~/.profile or ~/.bashrc . Then each time you open a new terminal, the command will be executed automatically. Since you are using zsh , you need to add the command to the ~/.zprofile or ~/.zshrc .

 ssh-add -K ~/.ssh/id_rsa &> /dev/null 

&> /dev/null should avoid viewing the Identity added message each time a new terminal window is opened.

+2
source

Try ssh-add -K again or edit ~/.ssh/config to enable this option:

Host * UseKeychain yes

If ssh-add states cannot connect, try configuring it with:

eval $(ssh-agent)

Similarly: https://superuser.com/a/1158050

+3
source

Source: https://habr.com/ru/post/1262653/


All Articles