git ssh ssh-agent

Could not open a connection to your authentication agent


I am running into this error of:

$ git push heroku master
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
!  Your key with fingerprint b7:fd:15:25:02:8e:5f:06:4f:1c:af:f3:f0:c3:c2:65 is not authorized to access bitstarter.

I tried to add the keys and I get this error below:

$ ssh-add ~/.ssh/
Could not open a connection to your authentication agent.


  • 40

    Question: once you’ve gone through EVERY answer on this page, and none of them work. What can you do next?

    May 7, 2015 at 2:08

  • 17

    @BrandonBertelsen Try this one: $ ssh-agent /bin/sh and $ ssh-add $yourkey

    – shyam

    Feb 8, 2018 at 3:57

  • @BrandonBertelsen Next you should use git config --list to see if you have set credential.helper – if you have you should remove this setting, as the helper is being unhelpful.

    – yoyo

    Mar 7, 2019 at 5:14

  • Also see

    – djvg

    Oct 6, 2021 at 9:29


I tried the other solutions to no avail. I made more research and found that the following command worked. I am using Windows 7 and Git Bash.

eval $(ssh-agent)

More information in: (web archive version)


  • 14

    Worked on Windows 8 too.

    Mar 17, 2014 at 7:35

  • 8

    Great !! Worked with windows 10 also.

    – NitinM

    Nov 6, 2019 at 17:33

  • 2

    Worked on Manjaro

    – fantom

    Dec 23, 2019 at 6:10

  • 2

    $ eval “$(ssh-agent -s)” worked for me on Windows 10

    Mar 22, 2020 at 14:12

  • 2

    thank you, worked like a charm! depending on which console you are using, it might not know which socket to use to connect to the ssh agent service, eval seems to fix that for you by setting the environment variable for that console, at least how I understand it

    Sep 2, 2020 at 8:25


The following command worked for me. I am using CentOS.

exec ssh-agent bash


  • 4

    Thanks, this worked for me, I ran ‘exec ssh-agent zsh’ for my shell.

    Feb 19, 2014 at 9:49

  • 2

    According to this deleted “answer”, it works on Amazon Linux AMI too. I guess it’s a Unix/Linux/*nix solution.

    – user456814

    Apr 19, 2014 at 19:00

  • 5

    I ssh’ed into a docker container and ssh-add my.id_rsa would fail on me. But exec ssh-agent zsh gave a environment where I could ssh-add with no problem. And I’m inside my docker container 🙂

    – markuz-gj

    Jun 12, 2014 at 2:33

  • Can anyone please briefly explain what the issue might have been? Thanks 🙂 This worked on my Ubuntu 14.04 too.

    Feb 10, 2016 at 13:13

  • I did the same but exec ssh-agent fish. None of the other solutions worked for me. This should be the accepted answer. I could not add my identity on Raspbian buster.

    Sep 19, 2020 at 16:08