Remember git passphrase in WSL

后端 未结 3 662
無奈伤痛
無奈伤痛 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:34

    I tried both methods in previous answers (as well as others found elsewhere) on WSL 2 and they either did not work or had caveats I couldn't live with. This is what worked for me.

    Install keychain:

    sudo apt install keychain
    

    Then add the following line to your shell's configuration file (likely ~/.bashrc or ~/.zshrc):

    eval `keychain --quiet --eval --agents ssh id_rsa`
    

    Now you will only have to enter your password when booting WSL!

    Thank you Birk Holland for this article.

提交回复
热议问题