SSH Key - Still asking for password and passphrase

后端 未结 30 1366
孤街浪徒
孤街浪徒 2020-11-27 08:35

I\'ve been somewhat \'putting up\' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance w

30条回答
  •  离开以前
    2020-11-27 09:20

    I tried all the answers here and none of these answers worked! My password would not persist between sessions/restarts of my Mac.

    What I found out from reading this OpenRadar and this Twitter discussion was that Apple purposely changed the behaviour for ssh-agent in macOS 10.12 Sierra to no longer automatically load the previous SSH keys. In order to maintain the same behaviour as El Cap I did the following:

    1. ssh-add -K ~/.ssh/id_rsa
      Note: change the path to where your id_rsa key is located.
    2. ssh-add -A
    3. Create (or edit if it exists) the following ~/.ssh/config file:

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

    And now my password is remembered between restarts of my Mac!

提交回复
热议问题