1

Every time I restart, I need to execute ssh-add, or git fetch will fail and give me a "permission denied" message. How do I solve it?

Makoto
  • 104,088
  • 27
  • 192
  • 230
husker
  • 87
  • 1
  • 1
  • 11
  • 1
    Lots of questions to ask here: first, what are you connecting to - a private repository in a company, or GitHub/Bitbucket/GitLab? Do you have more than one key defined on your system that could cause the confusion? – Makoto Mar 07 '17 at 03:44
  • it is a private repository in company,and i do not have more than on key. – husker Mar 08 '17 at 01:58

1 Answers1

1

On mac, you can use ssh-add -K ~/.ssh/your_private_key

If not, you need to add that step in ~/.profile.
You have other alternatives detailed in "Add private key permanently with ssh-add on Ubuntu" which might apply to MacOS as well.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250