So Windows 2004 update is here, and I was really excited about this update. Because it brings WSL2 as a production-ready product to our daily drive...
For further actions, you may consider blocking this person and/or reporting abuse
I'm a bit confused about the script. My repository is located on /mnt/....
How would I create a link accessible from Windows to my repository? I'm confused about what "Code" refers to in the script. I attempted the following...
@echo off
START /B "" pushd \wsl$\Ubuntu\
rmdir link /s /q
mklink /d link target
where
link = the intended location of the link folder (in Windows)
target = Z:/mnt/... (location of my repository in wsl)
This creates the link, but the link produces an error (attached).
My general goal is to get access to my repository (Linux-based work), but have Git behave at a "normal" pace, as it does on Windows. If the above is aimed to achieve this, I would really appreciate an assist.
Thanks in advance...
Hi! I would really like to help you, but I'm not using windows anymore :(
Does my "recipe" sound like it should achieve the goal though? I appear to be having the same issue as Nabeel below, where the symbolic link is not visible from the WSL side. Was that not your experience, or are we missing a step? If you don't remember, that's okay. I'll try to figure it out and post a solution.
Your solution looks good to me.
I asked my collegues if he was solving something like this, and he said he's using this script. It will run windows git under /mnt and linux git at other dirs. Meaning it will keep the speed of native git at all directories gist.github.com/jasonboukheir/3fda...
Unfortunately, this does not seem to work either. Even after creating the script, typing git still defaults to linux git. It doesn't see my script. Can you please connect me with your colleague for further inquiry?
Never mind... I just went with a simpler solution. Moved my project to the WSL filesystem (/home//project and lunched VS Code from there. I can now access it as if it was any other VS code workspace, but as it is now on the WSL filesystem, the default WSL git is at normal speed.
Thanks for everything :)
I try to link directly the
\\wsl$
and it seems to work, disk performance are back to normal and I doesn't need a startup script.[Edit]: after navigating through these folders, Explorer switchs path from
C:\...
to\\wsl$\...
and I cannot open the new path with my IDE (phpstorm)this is not a true solution, say you delete your wsl2 distro's ext4.vhdx, all of your project files are gone... "rmdir C:\Users<Your Windows Username>\Code /s /q" --> delete the windows side folder.
all you're doing is just making a shortcut into the wsl distro, so you can see the project files from windows explorer...
My solution for accessing my harddirves is (wsl2 sshfs:/mnt/d/) -> (wsl1 ssh server)
explaination :- light wsl1 distro (which has faster drive access by design) with ssh server, connecting to it's /mnt/(d,f,g,..) via sshfs from wsl2 distro, much faster access than direct drive access from wsl2
also for project files i have separate ext4 vhdx mounted on wsl2 distro, top speed file access, and your data is separated from the system(OS) disk, 👌 say your distro corrupted, windows had to reinstall without any back up of C: drive, no worries project files are in separate disk in a separate partition on real disk
Hi Matej,
Thanks for the idea, the thing is I don't follow now do I access the windows files now from WSL? they doesn't show up under the
/home/{username/
dir"Z:\home<Your WSL Username>\Code" could it be "Z:\Code"?
Coincidentally I have a Z: disk and I keep my Projects in a directory at the root. I didn't quite understand why "home \ wsl_username".
Why not run git from wsl?
You're using git in WSL, the problem is with mounted windows. When windows is under
/mnt
git is extremely slow, and for me personally and projects what I'm developing in work it's really a bummer. This repository is more than 10 years old, and simplegit status
is taking about 5 seconds. With this "hack" the git is running really smooth. Basically git something which is running on top of your filesystem, so it makes sense that it could be slower on mounted filesystems.If I run this as soon as the session is logged on, it results in an error. So you can have it delay by 15 min at logon. That worked for me.
Extremely helpful. Just what I was looking for, thanks!
For simplicity here's my share github.com/microsoft/WSL/issues/44...