https://github.com/rupor-github/wsl-ssh-agent
古い Memo/Windows/10/WSL/ssh-agent-wsl と比べて
Set-Service -Name ssh-agent -StartupType Automatic Start-Service -Name ssh-agent Get-Service -Name ssh-agent Status Name DisplayName ------ ---- ----------- Running ssh-agent OpenSSH Authentication Agent
exec $SHELL -l
# $HOME/.ssh/id_rsa が登録される ssh-add # 秘密鍵が登録されたか確認 ssh-add -l
ssh-add -l
sudo apt update sudo apt -y install socat
vim ~/.bash.d/wsl-ssh-agent.sh -- export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock ss -a | grep -q $SSH_AUTH_SOCK if [ $? -ne 0 ]; then rm -f $SSH_AUTH_SOCK ( setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"/mnt/c/local/wsl-ssh-agent/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & ) >/dev/null 2>&1 fi -- chmod +x ~/.bash.d/wsl-ssh-agent.sh
wsl-ssh-agent-gui.exe -socket c:\local\wsl-ssh-agent\ssh-agent.sock
echo 'export SSH_AUTH_SOCK=/mnt/c/local/wsl-ssh-agent/ssh-agent.sock' >> ~/.bash.d/wsl-ssh-agent.sh chmod +x ~/.bash.d/wsl-ssh-agent.sh