Skip to content

Instantly share code, notes, and snippets.

@doitian
Last active June 14, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doitian/078e6872a017754c28dd5ce0aa10375b to your computer and use it in GitHub Desktop.
Save doitian/078e6872a017754c28dd5ce0aa10375b to your computer and use it in GitHub Desktop.
Share ssh and gpg keys with WSL
ln -snf "$(which plink.exe)" "$HOME/bin/ssh"
ln -snf "$(which pscp.exe)" "$HOME/bin/scp"
# Or use Win32 OpenSSH. Since it does not support gpg-agent, I use putty instead
# ln -snf "$(which ssh.exe)" "$HOME/bin/ssh"
# ln -snf "$(which scp.exe)" "$HOME/bin/scp"
ln -snf "$(which gpg.exe)" "$HOME/bin/gpg"
ln -snf "$(which gopass.exe)" "$HOME/bin/gopass"
# Prepend $HOME/bin to PATH somewhere in the shell rc file.
# export PATH="$HOME/bin:$PATH"
@doitian
Copy link
Author

doitian commented Jun 14, 2020

Since WSL2 can use Windows executable directly, the most straightforward way is just using the Windows counterparts.

@doitian
Copy link
Author

doitian commented Jun 14, 2020

If git throws error like "unknown option -o", configure core.sshCommand to disable git protocol 2

git config --global core.sshCommand "$(which plink.exe)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment