The problem
If you use ssh-agent with an encrypted ssh key it does not persist when you open a new terminal window.
The solution
Use keychain
instead.
- Install
sudo apt install keychain
- Add to your shells rc file, eg.
.bashrc
or.zshrc
# Repeat this line for all keys you want to unlock and use this way /usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa source $HOME/.keychain/wsl-sh
- Unlock your keys on shell startup and enjoy