Every time I try to interact with git after I restart my machine I and given an error saying I have been denied access.

To fix this I enter the command

sudo ssh-add -K ~/.ssh/github_rsa

This works until I restart my computer and have to enter it again. This is the page that has helped me so far.

How can I get it so I don't have to enter this every time. Seems to work fine from other machines

  • I think you don't need sudo for doing that... – konus Sep 29 '14 at 5:41
  • Without it says permission denied – Will Sep 29 '14 at 9:57
  • Well, that's odd. You should chown it (sudo chown youruser:staff ~/.ssh/github_rsa in order to regain permissions. – konus Sep 29 '14 at 11:48
  • I have given that a go. I will let you know how it goes. Cant restart my machine right now. – Will Sep 29 '14 at 12:46

For anyone else still looking, I found a working solution on Stackexchange, based on a question on Reddit that mentions this problem, specifically with macOS Sierra.

In addition to ssh-add -K you also have to create a new file ~/.ssh/config with this content:

Host *
   UseKeychain yes
   AddKeysToAgent yes
   IdentityFile ~/.ssh/id_rsa
   IdentityFile ~/.ssh/id_25519

Worked for me, hope this helps someone :)


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.