SSH Key - Still asking for password and passphrase

后端 未结 30 1444
孤街浪徒
孤街浪徒 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:15

    On Mac OSX you can add your private key to the keychain using the command:

    ssh-add -K /path/to/private_key
    

    If your private key is stored at ~/.ssh and is named id_rsa:

    ssh-add -K ~/.ssh/id_rsa
    

    You will then be prompted for your password, which will be stored in your keychain.

    Edit - Handle restart

    In order to not have to fill in your password even after a restart add the following to your ssh configuration file (commonly located at ~/.ssh/config)

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

提交回复
热议问题