Closed anpin closed 4 years ago
Thanks for reporting this issue.
Does manually running
wsl bash -c "git --version"
from cmd or PowerShell still work with WSL2, or were there any changes to the command line interface?
You may also try an unreleased alpha build of wslgit
, which changed/unified the invocation of git
.
Manually running wsl bash -c "git --version"
in PowerShell gives me a version of git installed in wsl and returns back to PowerShell. I ended up installing git on windows, but I will try to use the alpha build when I have time.
I'm on 191025 and wslgit works for me. My mount points are on /
and not /mnt/c
. I've cloned a repository into my home directory, which is then shared to\\wsl$\Ubuntu-18.04\home\me\something
. I've then linked /mnt/c/www/something => /home/me/www/something
and C:\www\something => \\wsl$\Ubuntu-18.04\home\me\www\something
.
Now I can use PhpStorm with the project directory C:\www\something
(it doesn't allow paths with an '$') and C:\Tools\wslgit\wslgit.exe
as git executable. For PhpStorm's git test to work, I also needed to link /mnt/C/Users => /C/Users
.
Maybe wslgit could offer some options to configure those paths. So creating symlinks won't be necessary. Also a way to use a non-default distro.
@phox4ever I'm not sure that this is possible like you described.
I created a symlink:
ln -s /home/me/www/something /mnt/c/www/something
which creates a file with the name something
in C:\www\something
Then I tried:
mklink /d C:\www\something \\wsl$\Ubuntu-18.04\home\me\www\something
and it complains that the file with the name something
already exists.
Can you please describe the exact commands you used to create these mappings?
@stevium My mount root is '/', not '/mnt/'. Also, I was using wslgit version 0.8.0. The latest version uses a different method of handling paths. I'm currently running PhpStorm within WSL2 and x410 which works straightforward (until you put your Laptop to sleep...).
My /etc/wsl.conf
:
#enable extra metadata options by default
[automount]
enabled = true
root = /
options = "metadata,umask=22,fmask=11"
mountFsTab = false
@phox4ever Ah I see now, having the root mounted on /
will not create a /mnt/c/...
symlink in C:\...
directory and wslgit
mappings would still work. Nice idea! Sorry for not noticing at first.
Yes, now when wslgit
is updated we don't need this mapping anymore. I tried the develop
branch, and looks pretty functional.
Thanks for helping!
@stevium Version 0.9 is using wslpath, which cannot handle UNC paths, symlinks to UNC paths and network drives. But I'm thinking of wrapping wslpath in a bash script which overrides certain Windows paths to local Unix paths on the fly. Or is there an option coming up to create those path mappings for wslgit?
I only had problems with 0.9
when I wanted to use it with IntelliJ. That's why I decided to try the develop
branch. And it seems to be handling UNC paths (\\wsl$\...
) pretty fine. I was able to execute all the essential git commands, and even use Intellij on a large git project with a lot of submodules.
Maybe I'm missing something, but I don't see that these mappings are necessary anymore...
What exact command is failing for you?
Not sure about IntelliJ, but for PhpStorm, using UNC paths directly is not possible. https://youtrack.jetbrains.com/issue/IDEA-123273. I haven't tried with version 2020 yet though. So even if wslgit can handle \wsl$, PhpStorm still needs a Symlink. Not sure if this works also.
Most of the UNC issues were resolved with 2020.1 release: https://youtrack.jetbrains.com/issue/IDEA-197573 I've tried Intellij Idea, Rider, and Clion 2020.1
all of them supporting wsl2 and wslgit. So I would expect PhpStorm also to support it.
I've tested it with PhpStorm 2020.1 and I can confirm it works with the develop
branch! Thank you.
The changes from the develop
branch have now been released as version 1.0, so I think this can be closed. Feel free to open another issue if you encounter any further problems.
Just installed the latest insider build 18970 with Ubuntu 18.04 on WSL2 with .zsh and running wslgit.exe from PowerShell just opens a new bash session. Please see screenshot below
Edit: tried to set Windows environment WSLGIT_USE_INTERACTIVE_SHELL variable to 0 and it didn't works the same way