rdi_wq
Last Updated: November 14, 2018
·
99.46K
· fardjad

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.

15 Responses
Add your response

8509

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

over 1 year ago ·
10868

@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

Yes,
It work
thanks!

over 1 year ago ·
14095

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

thanks, it helped.

over 1 year ago ·
14159

it work perfectly for me, thanks

over 1 year ago ·
16384

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

Thank you very very much!

over 1 year ago ·
17601

Thanks a lot, that solved it ! :D

over 1 year ago ·
17898

Thanks.. Works like a charm..

over 1 year ago ·
17977

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

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

over 1 year ago ·
22883

Worked..thank you!!

over 1 year ago ·
31246

This is what I need, Thank you friend.

4 days ago ·
Filed Under