Setting up SSH keys in 1Password for WSL2
Use the 1Password password manager to store your SSH keys to enable SSH access to GitHub and other servers that you work on in Windows Subsystem for Linux (WSL2).
In my previous post, I described how to set-up SSH keys in 1Password for Windows. You can take this one step further and enable it to work in Windows Subsystem for Linux (WSL2) as well.
There are a few tutorials available online which detail some rather complex methods that include installing multiple dependencies, but this is unnecessary.
Assuming that you have completed all of the steps in my previous tutorial, here are the steps for setting-up 1Password SSH key management in WSL2:
Step 1:
Install the 1Password CLI in Windows via winget:
winget install -e --id AgileBits.1Password.CLI
Step 2:
Test that Windows OpenSSH is reachable by running the following command in WSL2:
ssh-add.exe -l
If that command says command not found inside WSL, try the full path:
/mnt/c/Windows/System32/OpenSSH/ssh-add.exe -l
Step 3:
Get Git in WSL to use the Windows SSH client:
git config --global core.sshCommand ssh.exe
Step 4:
Create aliases in ~/.bashrc or ~/.bash_aliases
alias ssh='ssh.exe'
alias ssh-add='ssh-add.exe'
Step 5:
Check if Git in WSL2 will trigger the use of the 1Password.
ssh -T git@github.com

After that, the normal 1Password dialogue box should be triggered when you interact with GitHub via SSH, or attempt to connect to any other server via SSH.

Comments
No comments have yet been submitted. Be the first!