Skip to content

Commit

Permalink
adopt ssh config for WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjenni committed Jan 21, 2024
1 parent 494bfb1 commit b2391a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bash/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 11 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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

}
Expand Down

0 comments on commit b2391a0

Please sign in to comment.