rdi_wq

Fix "Could not open a connection to your authentication agent." when using ssh-add

If you're trying to add identities to the authentication agent using ssh-add you might get the following error:

Could not open a connection to your authentication agent.

The reason as the error message suggests is, ssh-add doesn't know how to talk with the authentication agent.

The problem can be solved by setting SSH_AUTH_SOCK environment variable.

If you run ssh-agent you should get some output like this:

SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;

now if you evaluate the command output in your shell, the variable will be set:

eval $(ssh-agent)

Hope it helps.

14 Responses
Add your response

8509
7d4229521454ea7649c082da6115d456

Thanks! But I don't understand why I have to execute it every time...Is there any work-around?

over 1 year ago ·
10868
David michael welch

@crissdev: Add the eval $(ssh-agent) line to your ~/.bash_profile ( https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html ).

If you are using a shell other than bash, there are analogous user-specific config files.

Cheers!

over 1 year ago ·
12718
9b3197f94529a9a00c00f04ef09d0160

Yes,
It work
thanks!

over 1 year ago ·
14095
Nf2imfva normal

Finally got it working thanks to this post!!

Thank you a bunch :) it was so easy after all. Going back to playing with Heroku

TinyTiger from http://www.liki-tiki.com

over 1 year ago ·
14115
Ads z normal

thanks, it helped.

over 1 year ago ·
14159

it work perfectly for me, thanks

over 1 year ago ·
16384
4cb779d2c63f361f195f922feebee31e normal

thank you very much, I have been having this issue for the past few months. Every time I run composer update on my site instance I get asked to enter passphrase like a million times.....this post solved that issue!!

over 1 year ago ·
16834

thanks so much.. so much time wasted trying to figure this out.

over 1 year ago ·
17355
Tkh kjnu normal

Thank you very very much!

over 1 year ago ·
17601
None

Thanks a lot, that solved it ! :D

over 1 year ago ·
17898
None

Thanks.. Works like a charm..

over 1 year ago ·
17977
None

thank you. I was trying to follow github's tutorial to create SSH keys, and they seem to have forgotten about the "eval" part.

over 1 year ago ·
21212
None

I am sorry to say that it doesn't work for me! What's the reason?

over 1 year ago ·
22883
None

Worked..thank you!!

over 1 year ago ·