-
Notifications
You must be signed in to change notification settings - Fork 832
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
git status is slow in WSL2 #4401
Comments
On |
Yes. I noticed it shortly after I opened this issue.
…On Mon, Aug 12, 2019 at 3:28 PM therealkenc ***@***.***> wrote:
On /mnt I presume. #4197 <#4197>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4401?email_source=notifications&email_token=AAEZETSH7ZKLOZ4S6NG4I6DQEENJFA5CNFSM4IK5XT22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4B3VWY#issuecomment-520338139>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEZETSY5ZCKEF3PWQZVKUTQEENJFANCNFSM4IK5XT2Q>
.
|
I appreciate Microsoft's work on WSL and will stick with WSL 1 until the the performance issues with accessing the Windows filesystem from WSL2 are worked out. I'm surprised that I didn't hear about this limitation ahead of time, though. The discussions I heard regarding WSL2 (like during this year's Build talks) focused on its performance improvements, so I was surprised by the significant downgrade in performance. In my case, I use WSL to interact with Unity projects targeting Windows, so using the Linux filesystem doesn't seem to be an option. |
Same here and not only |
I came up with a dumb but useful workaround for this specific case. It works because windows git is faster against ntfs and I don't need any linux specific things for git at least. I put this in my bash # checks to see if we are in a windows or linux dir
function isWinDir {
case $PWD/ in
/mnt/*) return $(true);;
*) return $(false);;
esac
}
# wrap the git command to either run windows git or linux
function git {
if isWinDir
then
git.exe "$@"
else
/usr/bin/git "$@"
fi
} |
@TylerReid This doesn't solve the issues with WSL2 obviously, but this addresses my biggest issue with WSL2 at the moment. THANK YOU SO MUCH! |
We can't leave comments anymore in the initial issue. I discovered that GIT runs not that slow when the project is small, like 2-3 seconds slower than it should be (annoying but manageable) |
Why was this issue closed? It is still a super annoying issue (30+ seconds to return a git status or log). One issue with the above fix, is that using git.exe is super fast (like using git in WSL1), it doesn't run the aliases you've defined in your home directory with something like
|
* Disable starship git_status if we are not on NixOS to avoid problems like microsoft/WSL#4401 and starship/starship#301
Please open this issue. This is still relevant. |
Agree |
yes, the issue is still relevant. |
Also seeing this...
meanwhile, using Git Bash with the same repository, and git version
|
It feels like asking for a feature fix in a source code project but the last time I checked Windows 10 Pro costs $200 dlls |
LOL you are all lucky compared to me;
And initially cloning the project took about 1/2 an hour, whereas it would've taken a minute or two on Linux. This is incredibly frustrating since the whole point of having WSL (for me at least) was to do all my software dev in that environment. As such, the "use Windows git instead" workaround mentioned by others is not viable for me. I hate having two separate dev environments unless it's absolutely necessary, and to me, having to install Git for Windows just so I can run some simple commands that take less than half a second in Linux is ridiculous. |
@kenny1983 I was really hoping WSL2 was going to be a lot better but this is such a killer thing. Check out multipass as a WSL alternative. Not as tightly integrated but worked pretty well before I just completely gave up and went back to Linux. |
I have considered using
The best solution is to upgrade Git for performance enhancement |
If you are using So: I've just moved all my project into WSL itself ( Also you can access your WSL2 FS through |
@orosznyet I have this exact same setup and I'm still seeing extremely slow git operations. My repository is within |
@golkedj I understand your frustration. I've been there. I tried having the working directory within WSL on multiple systems and it usually solved the problem but you probably need a different solution/workaround. WSL also has its own config, you might find something related there: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wsl-2-settings |
Same here. 50x slower in WSL2 compared to WSL1. Unusable.
|
@orosznyet I have done some more testing on this. This issue is is the worst when running git operations on repositories that are located on Gitlab (all repositories, private, public, etc). When interacting with Gitlab I see speeds I am currently working around this issue by using Performance details:
|
it might have stayed closed because it's kind of a dup with the currently open #4197 |
A temporary workaround is to replace the in |
@UnsolvedCypher You can directly alias it in
|
I have disabled function isWsl {
if [[ "$(</proc/sys/kernel/osrelease)" == *microsoft* ]]; then
return true
fi
return false
}
function git {
if isWsl; then
git.exe "$@"
else
/usr/bin/git "$@"
fi
} This will run git.exe on all paths, not only Windows paths. |
Can confirm that the easiest workaround to get git fast again is to install git for windows and add an alias in your WSL2 to git.exe
I just tried that now and git is lightning fast, but there might be side effects I'm not aware of yet. |
@maor-rosenfeld One of the side effects is that worktrees' path will be constructed as Window style paths, which won't be well recognized.
|
So this means you might not be able to go back to using linux git without re-cloning the repo? |
@maor-rosenfeld It also means a compatibility problem when you maintaining a project in WSL (Linux git) and in IDEA (Windows git.exe) at the same time. The workaround for me is to keep the project and worktree copies in the same driver, and modify the
I have mentioned above: #4401 (comment) |
Using git.exe doesn't work for me. There are files in our git-repo that do not obey Windows file-name requirements (e.g. files with colon ":" in them), so I can't use a Windows-git. |
I have been using VS Code devcontainers based on Ubuntu 20.04 for a while, with mount points to the Windows file system via WSL2. It has been rather slow and sluggish with regards to Git operations, so I tried to look into it a bit today - ending up in this GitHub issue. As I did not want to pursue the git.exe workaround due to the implications mentioned above, I rather looked at what version of the Git Linux binary I was using. 2.25.1 was bundled with Ubuntu 20.04. I then found this article which states:
Hence, I rebuilt my devcontainer, adding the following to my Dockerfile:
After that, the Git version was updated to 2.32.0 - the latest stable. I have not made any measurements of any sorts, but at least the interactive experience of using the Git integration in VS Code inside the devcontainer is now much more performant. Hence, I wanted to bring it up as a suggestion for others. |
To complete @janegilring's comment #To add a new repo for apt update (can work with nano, vi.. you prefer editor). So I do not need to install 'software-properties-common' for add-apt-repository
sudo emacs /etc/apt/sources.list
# add the following line at the end (this repo, no issue on WSL2):
deb http://ppa.launchpad.net/git-core/ppa/ubuntu focal main
sudo apt update
#If after apt update, you get a complaint about The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1234567890123456798 do:
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x__REPLACE_BY_PUBKEYVALUE__" | sudo apt-key add
#Example: curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA1715D88E1DF1F24" | sudo apt-key add
#So you replace __REPLACE_BY_PUBKEYVALUE__ by your PUBKEY value
sudo apt update
sudo apt install git
git --version So I got git 2.32.0 version too but I didn't see a noticeable speed improvement |
I had the same problem: a slow (~12s) git repo located on I just switched to cloning my repo directly on the WSL2 linux filesystem ( As a side-note: it used to be heavily not-advised to access the WSL2 linux filesystem from windows, for example editing files with an IDE etc... This is because it would cause file corruption: see this official blog note However, according to more recent updates mentionned in this official blog note from 2019, it now seems perfectly fine to do it |
Thanks so much! my only addition is that I use |
If you are using an IDE that supports WSL 2 and git (using extensions or plug-ins) like Visual Studio Code do git tasks/command using that extension/plug-ins the performance is superb :-D |
Windows please stop hiding basic features that you can't solve. This issue should be open, it is still relevant to WSL2 users, and it is a major issue that prevent using Windows for development. Git is ubiquitous in development, windows should be able to handle it decently The idea behind WSL2 is that Windows users could use Linux without too much hassle. But right now it's harder to use WSL2 than Windows or Linux. Because users need to know all the mess you created between Windows and Linux I remember 10 years ago watching the video with Microsoft presenting WSL1 and insisting this was not just a VM in Windows, but a full built in Linux. That was straight up a lie. 10 years later you guys still can't access the Windows filesystem from your cheap Ubuntu VM |
Git is still absurdly slow under WSL. There is no reason why this ticket should be closed. Reopen it and fix your stuff. Thanks. Sorry for the rudeness. |
The root of the issue (slow cross-os file system performance) is tracked elsewhere. This issue was closed because it is not specific to git. |
Please fill out the below information:
Your Windows build number: 18956
What you're doing and what's happening: type
git status
What's wrong / what should be happening instead:
very slow.
time git status
gives meOn branch develop Your branch is up to date with 'origin/develop'. nothing to commit, working tree clean real 0m2.210s user 0m0.000s sys 0m0.452s
Note that this is quite small project.
The text was updated successfully, but these errors were encountered: