-
-
Save thefloatman/f26a478e4bbec1a50cdc1b5a61bd7896 to your computer and use it in GitHub Desktop.
Revisions
-
thefloatman revised this gist
Jul 8, 2021 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,18 @@ Run this command to switch SSH from CMD to WSL New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force ``` Edit .bashrc if you want set default shell other than bash (zsh) and add this code in ~/.bashrc ``` # Launch Zsh if [ -t 1 ]; then exec zsh fi ``` Reference: https://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/ ## Test ```pwsh -
mattbell87 revised this gist
Nov 8, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # VSCode Remote: Connect to WSL2 from another machine Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this. ## Change your OpenSSH shell SSH to your Windows host (SSH Server must be installed in Windows Features) -
mattbell87 revised this gist
Nov 8, 2020 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ # VSCode Remote: Connect to WSL2 from another machine ## Change your OpenSSH shell SSH to your Windows host (SSH Server must be installed in Windows Features) ```pwsh @@ -15,22 +17,22 @@ Run this command to switch SSH from CMD to WSL New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force ``` ## Test ```pwsh ssh user@windowshost ``` You should now see WSL2 instead of CMD ## Connect from VSCode At this point you can connect to your Win10 host with Remote SSH in VSCode with your Windows username and pw. But you'll actually start and connect to WSL2. 1. Install the Remote - SSH extension 2. Add a new SSH target and connect with your Windows host, username and password (you will automatically log in as the Linux user) ## Credit The workaround was inspired by: https://www.hanselman.com/blog/the-easy-way-how-to-ssh-into-bash-and-wsl2-on-windows-10-from-an-external-machine -
mattbell87 created this gist
Nov 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ ### Change your OpenSSH shell SSH to your Windows host (SSH Server must be installed in Windows Features) ```pwsh ssh user@windowshost ``` Start Powershell ```pwsh powershell ``` Run this command to switch SSH from CMD to WSL ```pwsh New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force ``` ### Test ```pwsh ssh user@windowshost ``` You should now see WSL2 instead of CMD ### Connect from VSCode At this point you can connect to your Win10 host with Remote SSH in VSCode with your Windows username and pw. But you'll actually start and connect to WSL2. 1. Install the Remote - SSH extension 2. Add a new SSH target and connect with your Windows host, username and password (you will automatically log in as the Linux user) ### Credit The workaround was inspired by: https://www.hanselman.com/blog/the-easy-way-how-to-ssh-into-bash-and-wsl2-on-windows-10-from-an-external-machine