Remember git passphrase in WSL

后端 未结 3 586
無奈伤痛
無奈伤痛 2021-01-11 14:52

I run Windows 10 with WSL. I have the desired behaviour on one computer, but cannot replicate elsewhere. Here\'s what I\'m after:

  1. First time I run a remote g
3条回答
  •  执念已碎
    2021-01-11 15:37

    I found the answer!

    First, make sure you have ssh-agent running all the time by adding eval $(ssh-agent) to your .bash_profile.

    Then add AddKeysToAgent yes to your ssh config:

    touch ~/.ssh/config
    chmod 600 ~/.ssh/config
    echo "AddKeysToAgent yes" >> ~/.ssh/config
    

    You'll get prompted when you first do some ssh, but the passphrase will be automatically added to the ssh-agent so you won't have to type it again until you end your session and start a new one.

提交回复
热议问题