From b2391a0693446787808144aaf001d6d016c999ce Mon Sep 17 00:00:00 2001 From: "david@david-pc" <3200210+davidjenni@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:07:55 -0800 Subject: [PATCH] adopt ssh config for WSL --- bash/bash_aliases | 5 +++++ bootstrap.sh | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bash/bash_aliases b/bash/bash_aliases index 03d528a..b9a8c6f 100644 --- a/bash/bash_aliases +++ b/bash/bash_aliases @@ -18,3 +18,8 @@ alias ...='cd ../../' set editing-mode vi myip() { wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'; } + +if uname -r | grep -q "WSL"; then + alias ssh='ssh.exe' + alias ssh-add='ssh-add.exe' +fi diff --git a/bootstrap.sh b/bootstrap.sh index d8e3ff5..2c42113 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -222,10 +222,11 @@ function setupShellEnv { copyFile fish/functions/ls.fish $fishConfigDir/functions/ls.fish # setup ssh to play with 1Password as identity agent: - copyFile ssh/config $HOME/.ssh/config + sshConfig=$HOME/.ssh/config + copyFile ssh/config $sshConfig sshPerms=u+rwx,go-rwx chmod $sshPerms $HOME/.ssh - chmod $sshPerms $HOME/.ssh/config + chmod $sshPerms $sshConfig touch $HOME/.ssh/known_hosts && chmod $sshPerms $HOME/.ssh/known_hosts case `uname` in 'Darwin') @@ -235,7 +236,14 @@ function setupShellEnv { ln -s "$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" $HOME/.1password/agent.sock fi ;; - 'Linux') ;; + 'Linux') + if uname -r | grep -q "WSL"; then + echo "on WSL, let the Windows host OS' 1Password identity agent resolve ssh authN" + # https://developer.1password.com/docs/ssh/integrations/wsl + rm $sshConfig >&/dev/null + git config --global core.sshCommand ssh.exe + fi + ;; esac }