andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.19k stars 59 forks source link

Multiple WSL distro support #127

Closed dixydo closed 1 year ago

dixydo commented 2 years ago

Hi! I have two Ubuntu WSL distro: Ubuntu and Ubuntu-20.04 for personal and working purposes respectively. I set git executable in PhpStorm as C:\Users\yevhe\bin\wslgit.exe and git integration works fine with Ubuntu, but not with Ubuntu-20.04. It returns error Error updating changes: not a git repository (or any of the parent directories): .git

Is it possible to get both of them working properly? If yes — how?

UPD: I have tried to download source code, replace Ubuntu-20.04 with Ubuntu and compile two different versions, but still no luck.

andy-5 commented 2 years ago

wslgit uses the default WSL distribution, which you can set via wsl --set-default, see https://docs.microsoft.com/en-us/windows/wsl/basic-commands#set-default-linux-distribution .

There is currently no way to use wslgit with multiple distributions at the same time.

carlolars commented 2 years ago

The problem is that wslgit always use the default wsl, so when accessing the filesystem from windows on another wsl instance the paths will translate to a Unix-path that exists on the other wsl instance, but wslgit will then run in the default instance where that path likely doesn't exist.

I'll push a PR soon that should make it possible to use wslgit with multiple distros, you just have to make sure git/ssh is setup correctly in all distros you intend to access repos in :)

andy-5 commented 2 years ago

@dixydo There is now an alpha build available with the changes from @carlolars : https://ci.appveyor.com/project/andy-5/wslgit/build/artifacts

Does this work for your use case?

dixydo commented 2 years ago

@andy-5 Thank you! Unfortunately I haven't possibility to test it right now as I'he already switched to single distro and route ssh config to repos manually to be able use your tool. I will try to test it on weekend.

andy-5 commented 1 year ago

The changes have no been released as wslgit v1.2.0.