Windows Subsystem for Linux and SSH configuration

  • From WSL installation to ssh connectivity with GitHub.

  • Find your files in Windows 10

  • Use Visual Studio Code and the extension Remote - WSL

 

Key commands, provided here to summarize the process, even if you will find plenty of websites on this topic.

Installation WSL on Windows 10

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Then, follow this quick guide to upgrade WSL v1 to v2. WSL v2 allows you to run Docker.

Reboot, to activate the new feature. Then, from the Windows Store, install 'Debian', 'Ubuntu' or your distribution of choice.

Where are the files stored in Windows 10 ?

From the WSL terminal (i.e. in Debian), type :  explorer.exe .    to open your windows explorer in the current directory.

From a Windows terminal, you will find the Debian root here :

DIR CD C:\Users\%USERNAME%\AppData\Local\Packages\TheDebianProject*

Update and install Git

sudo apt update && sudo apt upgrade
sudo apt-get install git

git config --global user.name "Your Name"
git config --global user.email "Your mail address"
git config --global core.editor "nano"

Configuration of ssh-agent

# Generate a private key, secure it with a passphrase
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

# To check the permissions, follow:
https://gist.github.com/grenade/6318301

# Start your ssh-agent. Ensure you got a PID.
eval $(ssh-agent -s)

# Add the priv key to ssh-agent (type the passphrase)
ssh-add ~/.ssh/id_rsa

# Check that your 'identity' is correctly listed and available
ssh-add -l

Check GitHub connectivity

Assuming you already stored your public key to your GitHub config.

# Attempts to SSH to GitHub
ssh -T git@github.com

Visual Studio Code

  • Setup Visual Studio Code
  • Install the extension (preview) Remote WSL (see link below) and get the ability to work directly in Code !

If you want to know more

Haut de page