-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
WSL compatibility #16378
base: development
Are you sure you want to change the base?
WSL compatibility #16378
Conversation
Hey @schummar, thanks for wanting to contribute! I wanted to set some expectations here that we will have to have a thorough discussion internally before we can provide any feedback here and that might take a while. GitHub Desktop ships with a specific custom built version of Git because we have to be able to rely on specific features being present, localization being turned off, and specific formats of Git output that could (and do) change between versions etc. Outsourcing that to a Git version we don't have control over would be fragile at best and poses other questions around ensuring compatible versions of Git LFS being installed etc. We would likely want to run a specific dugite version within the WSL environment. I certainly empathize with the friction you're encountering running Desktop alongside a WSL environment and it's clear that you've done a thorough job of going through the codebase to create a comprehensive solution but I want to set reasonable expectations that we won't have a lot of time to get into reviewing and considering this work in the short term. |
@niik thanks for the reply. I didn't expect this to be quick. Of course this is a big decision and will take time, no worries. I made the Pull Request also as a POC. The existing discussions regarding WSL were mostly "use UNC paths, it's working fine" and some tweaks and workarounds to make it somewhat workable. But that approach is fundamentally flawed and another idea is needed. I wanted to show that running git withing WSL might be such an idea. WSL is such a big deal for developers using Windows, so it deserves first class support in tools. 😉 Your point about using a specific git version makes sense. I see no issue with using an embedded git version also for WSL as well. I'll try to include this in the Dugite PR. Whenever you had time to discuss it and if you decide that the solution has potential, I'll be happy to work with you to iron out the problems and make it production ready. |
I have updated the Dugite PR |
A little script for anyone who wants to try it out: git clone https://github.com/schummar/dugite.git
git clone https://github.com/schummar/desktop.git
cd dugite
git checkout origin/feature/wslGit
yarn
yarn build
yarn link
cd ../desktop
git checkout origin/feature/wslCompatibility
yarn
cd app
yarn link dugite
cd ..
yarn build:prod
|
I can't comment on the code because I'm unfamiliar with this repository, but I've been testing this and the user experience is vastly improved. Everything is working smoothly so far. |
I've encountered a problem where an error is caused triggering a pre-commit hook:
Edit: This is an edge case where GitHub Desktop errors on the first commit installing git hooks. After committing using git in the terminal, the hooks get set up properly and then GitHub Desktop works correctly for subsequent commits. |
It seems that problem has been discussed a lot already in other issues quite a bit, so it's probably not connected to the WSL integration. See #10345 (comment). But if you can provide a repo that demonstrates the issue, I will have a look. |
what do we need to have this in the master branch? it's impossible to use github for desktop with a repo in WSL |
I've been using this branch. I do not use the main branch. Getting this merged into main branch is ideal so I can continue to get regular updates. |
I am currently waiting for feedback from the team. As @niik said, it can take some time. Maybe he can provide an update some time ;-) Btw. I merge the latest main/development branches from time to time, but be aware that using a build from this branch might be outdated and auto update can't work either. |
Should this be run in WSL or windows terminal? |
In Windows Terminal. |
I haven't looked at the details of this PR, but a good implementation for similar thing is to look at vscode. Actual vscode logic remains with vscode-server, and it's can run in any remote machine. Vscode is just the UI user interacts with. Github desktop could adopt a similar architure. Though realistically its seems kinda unfeasible considering desktop's team size / target audience. I've been using the shiftkey/desktop fork in wsl from the start of wsl2. It is my daily driver for software development. Needed some minor issue solving from time to time, but overall it just works. Especially after introduction of WSLg, using linux version of desktop just feels more realistic. |
How do I add a repository located on WSL? I'm unable to see WSL directories in the folder selector that pops up when I click "Browse". |
Yes, that would be a valid approach too. But a lot more effort, which is probably not needed for this use case.
That works generally, but I think the user experience is not optimal. WSLg windows are not as performant and seamless as native windows and if you work both on the Windows side and in WSL, you'd have to have the app installed twice. |
Showing the WSL drives in Explorer has been working occasionally for me, but it's indeed very flaky. What should always work is to put the path directly into the file picker's url. E.g. |
Is there any update on this? I'm using GitHub Desktop with a WSL mounted drive and every operation is way too slow, compared to non-WSL mounted drives. |
I think this is still experimental/under development? If you need a stable daily driver, install the linux version https://github.com/shiftkey/desktop and store code inside main wsl drive. |
I haven't heard anything new. To proceed I would first need feedback from the team on whether they agree with the approach and what steps would need to be taken to make it production ready. @niik can you share any update? Or what do you think are the chance that this will be discussed? |
So sad that this awesome pull request does not get any attention, I would really love this to be merged and enjoy WSL development |
What's holding this back from being merged? I've been using this for a year without issue |
Hey @schummar 👋, thank you for your effort on this. I'm trying it out locally and I have this error Do you have any suggestions on what could be wrong on my side? 🤔 |
You also have to use the modified version of dugite. See my comment: #16378 (comment) |
Hey @schummar I removed everything and started over and I still have an issue it happens when I select any repository inside WSL2 |
You can open devtools with |
I found this #17362 and followed the instructions to remove all local files from the original installation. After that I'm not able to login with Github account, for some reason it ends up on this page for ever, the link is doing nothing. So I decided to skip the login, but still the application can't see the repositories on WSL for me. Those are the errors in console: |
Are you running GitHub Desktop from within WSL? It's not meant to be used like this. The idea behind the PR is, that you run the application in Windows and access WSL folders from there. If you want to run it in WSL directly, you can try this fork that is meant be run in Linux environments: https://github.com/shiftkey/desktop If that is not the case, can you enable "All levels" in the console? Maybe there are more hints about where it's going wrong there. |
No other information when all levels set. Yeah I run it from the Windows. But all other developing-related things I have in WSL, so maybe I'm missing some library or something, but I have no idea what. I guess you don't need to waste energy on this issue, I needed GUI only from time to time, when I worked with too many updated files, as I had the need today again and just bought GitKraken for one year. Hopefully, GitHub will integrate your solution till then ;-) |
Sent from my iPhone
|
I tried the latest update and it's not working (no ability to add repos via UI), so I reverted to the previous commit |
Together with desktop/dugite#532, this potentially closes
git
executable #14222Description
Depends on desktop/dugite#532. Together this will introduce compatibility with WSL. While you can just open a repository in WSL by entering its UNC path, this never worked right for me and many others. It suffers from
My suggestion to solve all this simple: Run git within WSL
wsl.exe -e git ...
. The most important part is contained in the Dugite pull request. Assuming that gets merged, this PR fixes a few edge cases connected to it and improves WSL compatibility in regards to external editors and shells byThere are certainly some things to be discussed and edge cases to be fixed. I'm happy to make adjustments based on your feedback and hope that you can see the advantage of taking this route.
Screenshots
Release notes