3

I've seen the question here but I'm not sure if the same solution would apply to me

https://emacs.stackexchange.com/questions /17866/magit-how-to-use-systems-ssh-agent-and-dont-ask-for-password/17890#17890

I'm on Emacs 25.1 / Ubuntu 16.04. I've just set up ssh keys according to https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/ and I've added the public key to my github account.

When I try to push though, magit prompts me for my password to my account foobar@github.com (as always) rather than seeing that I've set an ssh key into ssh-agent.

M-x getenv SSH_AGENT_PID doesn't exist and M-x getenv SSH_AUTH_SOCK is /run/user/1000/keyring/ssh. echo $SSH_AGENT_PID is 18145. What is the next step from here?

  • M-x setenv SSH_AGENT_PID 18145? – npostavs Feb 20 '17 at 0:06
1

Edit ~/.ssh/config so that it contains the following:

Host github.com
  IdentitiesOnly yes
  IdentityFile ~/.ssh/your_ssh_key

Then whenever magit asks git to ask ssh to talk to github.com, ssh will know what key to use; saves a lot of mucking about.

  • The issue was I had the remote url set to https instead of ssh, I posted an answer for other people to see. I think you answer is useful for learning more about how the ~/.ssh/config works though, I think I'll need to refer to it in the future, thanks – irregular Feb 20 '17 at 3:26
1

The issue was that the remote url was set to https rather than ssh

following these steps fixed the issue https://help.github.com/articles/changing-a-remote-s-url/

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.