I have created file ssh-start.sh which contains:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
I'm running it and have output:
Agent pid 1234
Identity added: ~/.ssh/id_rsa (~/.ssh/id_rsa)
but when I run
ssh-add -l
I'm getting:
Could not open a connection to your authentication agent.
What am I doing wrong and how to fix that?
(when I run commands from ssh-start.sh file directly in terminal it works fine)
ssh-add -lpart of the script or you're running it after the script runs?