(I am using MAC OS High Sierra v.10.13.6) with Emacs v26.1

When attempting to push changes to a remote-repo (Github) using the package magit

I received the following error in the buffer.

Error (ssh-agency): ‘/usr/bin/ssh-add’ failed with status 1:
  • As far as I understand, the error is due to you not having any ssh keys.
    – npostavs
    Oct 24, 2018 at 0:18

1 Answer 1


I resolved the issue by doing the following:

  1. created a .ssh folder in Home (default directory in terminal)

  2. I then followed the following instructions https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

3.I then added the new public SSH key to Github by following these instructions https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

  1. I tested the SSH connection using ssh -T git@github.com (for more info see https://help.github.com/articles/testing-your-ssh-connection/)

  2. I then needed to switch over my existing remote repos to use SSH instead of HTTPS which i did using the instructions here: https://help.github.com/articles/changing-a-remote-s-url/#switching-remote-urls-from-https-to-ssh

  3. I tested with git remote -v

I could now see that it had changed over from HTTPS to SSH by observing the output as:

origin git@github.com:USERNAME/REPOSITORY.git (fetch) origin git@github.com:USERNAME/REPOSITORY.git (push)

  1. I went into emacs and made some changes to a file within the local git repo and did M-x m-stat [ret] and then C-c C-c then pushed the changes via the quick menu in magit and voila all is now working without any errors.

Restarted laptop to be sure and all is great.

I am sure there would have been an option for ssh passphrase auth using the github HTTPS origin but I didn't want to mess around with adding a passphrase into keychain and then adding this into the ssh-agent.

  • "an option for HTTPS auth [...] adding a password into keychain and then adding this into the ssh-agency." - ssh-agency only deals with ssh-agent, so you cannot add HTTPS passwords to it.
    – npostavs
    Oct 24, 2018 at 0:18
  • @npostavs your right sorry I meant ssh-agent. I have edited the answer to reflect.
    – PeteMcD18
    Oct 24, 2018 at 8:37
  • I think in this case it makes no difference, ssh-agent only takes ssh keys, it can't handle HTTPS authentication (and git wouldn't call it in that case anyway).
    – npostavs
    Oct 24, 2018 at 12:13
  • @npostavs your right again. My mistake. I was getting confused with SSH private key passphrases referred to here: apple.stackexchange.com/questions/48502/…
    – PeteMcD18
    Oct 24, 2018 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.