Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with WSL2 #82

Closed
anpin opened this issue Sep 4, 2019 · 12 comments
Closed

Doesn't work with WSL2 #82

anpin opened this issue Sep 4, 2019 · 12 comments

Comments

@anpin
Copy link

anpin commented Sep 4, 2019

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
image

Edit: tried to set Windows environment WSLGIT_USE_INTERACTIVE_SHELL variable to 0 and it didn't works the same way

@andy-5
Copy link
Owner

andy-5 commented Sep 5, 2019

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.

@anpin
Copy link
Author

anpin commented Sep 11, 2019

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.

@phox4ever
Copy link

phox4ever commented Nov 18, 2019

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.

@stevium
Copy link

stevium commented May 4, 2020

@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?

@phox4ever
Copy link

@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

@stevium
Copy link

stevium commented May 6, 2020

@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!

@phox4ever
Copy link

@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?

@stevium
Copy link

stevium commented May 6, 2020

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?

@phox4ever
Copy link

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.

@stevium
Copy link

stevium commented May 6, 2020

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.

@phox4ever
Copy link

I've tested it with PhpStorm 2020.1 and I can confirm it works with the develop branch! Thank you.

@andy-5
Copy link
Owner

andy-5 commented Aug 22, 2020

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.

@andy-5 andy-5 closed this as completed Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants