Windows
Repositories in WSL
6 min read
If you work in WSL (the Windows Subsystem for Linux), your repositories usually live inside the
distro, for example in /home/ana/projetos/api. Versora opens these repositories with the
distro's own git: the hooks, SSH and git configuration are Linux's, just like when you work
in the distro's terminal.
This solves two problems of Windows git on the \\wsl.localhost path: it's slow (every file read
crosses the boundary between the two systems) and it runs into the "dubious ownership" warning.
With the distro's git, the repository runs at Linux speed.
- Home: the Repository in WSL card ("Open it with the git inside Linux"), with the names of the installed distros. The card only appears when there are WSL distros on the machine.
- Palette (Ctrl+P): "Open a repository in WSL…".
- Any other path that opens the folder through the
\\wsl.localhost\<distro>\…address (or\\wsl$\<distro>\…) also uses the distro's git: the Windows "Open repository" dialog, the File Explorer orversora <folder>on the command line.
- On Home, click the Repository in WSL card. The Open a repository in WSL window opens.
- On the left, under Distros, choose the distro. Each one shows its WSL version and state: default, running or stopped (starts when opened). A stopped distro is started right away ("Starting the … distro…").
- On the right, browse the folders:
- click a folder to go into it;
- Parent folder (Backspace) goes up one level (Alt+↑ too);
- Home folder goes back to your user folder in the distro;
- or type the path in Linux path (for example
/home/ana/projetos) and click Go.
- Folders that are repositories have the repository badge. Symbolic links have the link badge, and folders without permission, no access.
- Go into the repository. The window confirms "This folder is a git repository." and shows the version of the distro's git ("Distro git: …").
- Click Open this repository (or the Open button on the folder's row).
The window remembers the last folder used in each distro. The first time, it starts in the default distro's home folder.
| Option | What it does | Default |
|---|---|---|
| Show hidden folders | Also shows the folders that start with a dot. | Off |
| Use the Windows dialog… | Switches to the Windows folder dialog, if you prefer. | — |
In a very large folder, the list shows only the first subfolders ("Large folder: showing the first … subfolders."). Type the path to go straight there.
In the clone window, next to the destination folder, there's the WSL button ("Choose a folder inside WSL"). It opens the Choose a folder in WSL window, with the same navigation, and the Choose this folder button. The clone is done by the distro's git, straight onto the Linux disk.
The button only appears when there are WSL distros on the machine. See the rest of cloning in Open, clone and create.
For a repository in WSL, each git command from the app runs inside the distro, in the repository folder:
wsl.exe -d <distro> --cd <repository folder> --exec git …
- Who runs git: the distro's git, with the hooks, SSH and configuration from there (Linux's
~/.gitconfig). - Paths: Windows paths become Linux paths on the way in (
C:\…becomes/mnt/c/…, and\\wsl.localhost\Ubuntu\home\ana\apibecomes/home/ana/api) and come back on the way out. In the tab, on Home and in the projects, the path is still the Windows one (\\wsl.localhost\…). - Credentials: for push and fetch over HTTPS, the servers registered in Versora provide the
credentials. SSH uses the Linux keys (
~/.ssh). - Environment: Linux only receives the variables the app sets for the command (git's, the
proxy's and the language). Windows variables, such as a
GIT_SSHwith a Windows path, don't pass through, because they would break Linux git. YourWSLENVis respected. - Activity log: the commands still show up as
git …. See Activity log.
Versora notices right away what you change in the distro (in the editor or in the Linux terminal)
through inotify inside Linux. For that, the distro needs python3, which already comes with
Ubuntu and Debian. Without it, the app checks for changes every 3 seconds.
The repository's tab and bar show the WSL · … badge, with the distro's name (for example, WSL · Ubuntu). Hover over it to see:
- "Repository in WSL (…): git, hooks and SSH run inside Linux.";
- the Linux path;
- how changes on disk are detected: "Changes on disk: reported right away by Linux inotify." or "Changes on disk: checked every 3 seconds (no python3 in the distro to use inotify).".
The integrated terminal (Ctrl+`) of a repository in WSL opens inside the distro, with your default shell there, already in the repository folder. See Integrated terminal.
The internal distros of Docker Desktop and Rancher Desktop (docker-desktop,
docker-desktop-data, rancher-desktop, rancher-desktop-data) don't show up in the list and
are never touched by the app.
Opening a repository in WSL doesn't change anything in the repository or in the distro. To remove the project from Home, use the project's menu, as with any other repository. The git operations done afterward (commit, checkout, merge…) are undone with Ctrl+Z as in any repository. See Undo.
- "No WSL distro found. Install one with wsl --install in a Windows terminal and come back here.": WSL has no distro (or only Docker's and Rancher's internal ones).
- "Git isn't installed in this distro. Install it from a terminal in the distro (on Ubuntu and Debian: sudo apt install git).": install git inside Linux. When running a command, the message is "Git isn't installed in the … distro. Install it from a terminal in the distro (on Ubuntu and Debian: sudo apt install git) and try again.".
- "This folder isn't a repository: go into one (marked “repository”).": you're in a regular folder. Go into the repository folder.
- "You don't have permission to open this folder": the folder belongs to another Linux user.
- "There's only … hidden folder here (check “Show hidden folders”).": turn the option on to see it.
- "The … distro isn't installed in WSL.": the distro was removed after the project was added to Home.
- "The folder … doesn't exist in the … distro.": the folder was deleted or moved inside Linux.
- "Enter a Linux path starting with / (for example, /home/you/projects): …": the Linux path field only accepts absolute Linux paths.
- "The … distro didn't respond within 60 seconds.": the distro took too long to start or is stuck.
Try
wsl --shutdownin a Windows terminal and open it again. - "Couldn't start WSL: …" and "WSL refused the command (…): …": WSL itself failed. The message includes its error.
- "This folder isn't in WSL: …": the chosen path isn't in a distro.
WSL has no page of its own in Preferences. The integrated terminal's shell in WSL is the distro's default, not the one in Preferences › Terminal.
The app passes to Linux the proxy variables it sets for the command, so the proxy in Preferences › Network also applies to the distro's git (see Proxy). The company's network policy, such as the allowed servers, sees WSL's git command like any other. See Policy keys.