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: Support WSL #9502

Open
tianvan opened this Issue Jul 19, 2016 · 95 comments

Comments

Projects
None yet
@tianvan
Copy link

tianvan commented Jul 19, 2016

qq 20160720033734

@joaomoreno joaomoreno added this to the Backlog milestone Jul 21, 2016

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Jul 21, 2016

This was fast. The thing literally came out yesterday for everyone.

Actually, it's still not yet out, so support for this will take its time.

@joaomoreno joaomoreno changed the title Only support Git for Windows,Please support Git for Bash on Ubuntu on Windows Support Git for Bash on Ubuntu on Windows Jul 21, 2016

@johnbwoodruff

This comment has been minimized.

Copy link

johnbwoodruff commented Aug 6, 2016

It would be great to use Bash on Ubuntu on Windows as the integrated terminal! Not to mention its git installation for the git tab. I can't +1 this enough! :)

@johnbwoodruff

This comment has been minimized.

Copy link

johnbwoodruff commented Aug 31, 2016

Noticed that we can use the Bash on Ubuntu on Windows terminal in the integrated terminal now. That's awesome! Now we just need the git integration with the git version installed through bash on ubuntu on windows.

@dalyIsaac

This comment has been minimized.

Copy link

dalyIsaac commented Sep 18, 2016

+1

@joaomoreno joaomoreno removed their assignment Sep 19, 2016

@ncarroll

This comment has been minimized.

Copy link

ncarroll commented Oct 12, 2016

+1

1 similar comment
@nmbradford

This comment has been minimized.

Copy link

nmbradford commented Oct 19, 2016

+1

@jonomacd

This comment has been minimized.

Copy link

jonomacd commented Oct 31, 2016

This would be great not just for git but for extensions as well. I use the vscode-go extension and it shells out to use the command line tools often. I'd like it if it could shell out to bash as opposed to windows terminal. It would also need access to environment variables from bash. Basically, I want it to think it is in a bash environment even though it is in windows.

Thanks.

@ElieMyIdea

This comment has been minimized.

Copy link

ElieMyIdea commented Aug 24, 2017

+1

6 similar comments
@andre2

This comment has been minimized.

Copy link

andre2 commented Aug 31, 2017

+1

@doxiaodong

This comment has been minimized.

Copy link

doxiaodong commented Sep 4, 2017

+1

@lobabob

This comment has been minimized.

Copy link

lobabob commented Sep 25, 2017

+1

@EmmanuelVlad

This comment has been minimized.

Copy link

EmmanuelVlad commented Sep 29, 2017

+1

@kidpollo

This comment has been minimized.

Copy link

kidpollo commented Oct 26, 2017

+1

@mikhailbalin

This comment has been minimized.

Copy link

mikhailbalin commented Nov 9, 2017

+1

@lugolven

This comment has been minimized.

Copy link

lugolven commented Nov 17, 2017

+1 :)

@sgiradoa-psl

This comment has been minimized.

Copy link

sgiradoa-psl commented Nov 17, 2017

+1

@joaomoreno joaomoreno changed the title Support Git for Bash on Ubuntu on Windows Git support for WSL Nov 20, 2017

@skippednote

This comment has been minimized.

Copy link

skippednote commented Nov 20, 2017

@joaomoreno Wanted to check if there any work being done on this WSL git + VSCode integration?

@pd93

This comment has been minimized.

Copy link

pd93 commented Jul 27, 2018

@sudesh-poojari I should clarify. I am not currently using Git with wslpath. I'm still using separate Git installations for Windows and WSL. However, I do sometimes use wslpath for other things.

There is an open issue for implementing wslpath into Andy's project, but there are a couple of blocking problems that need to be worked out. Take a look at the issue comments for details.

@hangxingliu

This comment has been minimized.

Copy link

hangxingliu commented Jul 27, 2018

@pd93 Thanks for your guide. I pushed a new commit in my repository. include fixed a bug about Windows batch file (escaped characters) and wslpath support for input parameters.

By the way, Do you have a good idea about convert linux path in git output to Windows path by using wslpath? Or maybe I need parser wsl.conf to resolve it?

@pd93

This comment has been minimized.

Copy link

pd93 commented Jul 27, 2018

@hangxingliu the -w flag will convert from a WSL formatted path to a Windows one. eg:

# Windows -> WSL
wslpath C:\\Users\\Pete
# Output: /mnt/c/Users/Pete

# WSL -> Windows
wslpath -w /mnt/c/Users/Pete
# Output: C:\Users\Pete

You can also ensure that you get an absolute path by parsing the -a flag
wslpath still works for the above example even if your mount point is / instead of /mnt (like mine is)

@hangxingliu

This comment has been minimized.

Copy link

hangxingliu commented Jul 27, 2018

@pd93 That's right. Sometimes the output of git is only a path string, for example:

> git rev-parse --show-toplevel
/mnt/c/repo1

But there are some conditions: the output of git is not only a path string, also many other description text .and maybe includes more than one path, for example:

> git remote -v
local   /mnt/c/local_remote (fetch)
local   /mnt/c/local_remote (push)
origin  git@github.com:hangxingliu/wslgit.git (fetch)
origin  git@github.com:hangxingliu/wslgit.git (push)

So It is hard to extract which part is a Linux path be mounted from Windows drive by using wslpath only in the second condition(The output included more than one path or included other strings)

@hangxingliu

This comment has been minimized.

Copy link

hangxingliu commented Jul 27, 2018

@pd93 Up to latest commit in my wslgit repository. It supported convert Linux path in git output to Windows path by wslpath or awk (replace path following WSL mounted drvfs list).

@andy-5

This comment has been minimized.

Copy link

andy-5 commented Jul 30, 2018

For anyone having performance issues with wslgit or similar tools, the slowdown is most likely caused by the execution of your Bash startup scripts (like .bashrc).

For andy-s/wslgit specifically, you can force it to not start an interactive Bash shell, which skips executing .bashrc, by setting the Windows environment variable WSLGIT_USE_INTERACTIVE_SHELL to false (as documented here). This can significantly speed up wslgit, but does not run any tools like ssh-agent, etc. you may have added to your .bashrc.

@mickeypuri

This comment has been minimized.

Copy link

mickeypuri commented Aug 16, 2018

Discussing with a colleague, he has simply set in vscode user preferences, the terminal.integrated.shell.windows to point to the bash.exe for WSL, and then set git.path in vscode preferences to the path in the WSL where git is installed e.g.

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe",
"git.path": "C:\\Users\\some_user_name\\AppData\\Local\\lxss\rootfs\\usr\\bin\\git",

It appears to work however he is not using the vscode git plugin as it felt flaky. Is this a potential solution or is something being missed in this setup (as I know we are not meant to alter any files in the linux system using any windows tools)?

(One point on the git.path, more recent installs of bash, will use a different path rather than the lxss folder as outlined here )

@haddigan

This comment has been minimized.

Copy link

haddigan commented Aug 17, 2018

@mickeypuri I just tried this and VSCode is unable to find the source provider. What is it that appears to work if your colleague isn't using the source control integration? I'm not sure what setting git.path would accomplish otherwise. You can definitely point the integrated shell to WSL and run git from the command line, but this issue is for being able to use the Source Control integration with WSL's git.

@galcianuk

This comment has been minimized.

Copy link

galcianuk commented Aug 17, 2018

Would also like support for this!

@duttaditya18

This comment has been minimized.

Copy link

duttaditya18 commented Oct 12, 2018

Can anyone take a look at this Gist by @victor-perez : https://gist.github.com/victor-perez/8ba25540394ec68b11f4b2699fb4d4ce

It doesn't work for me. Can anyone else test it out?

@duttaditya18

This comment has been minimized.

Copy link

duttaditya18 commented Oct 12, 2018

Figured it out by using this : https://github.com/andy-5/wslgit

@mike-zipit

This comment has been minimized.

Copy link

mike-zipit commented Nov 19, 2018

@phifa

This comment has been minimized.

Copy link

phifa commented Feb 8, 2019

@joaomoreno Integrating WSL GIT into VS Code would be amazing! Any updates here?

@mmirus

This comment has been minimized.

Copy link

mmirus commented Feb 8, 2019

@phifa I've been using it in VS Code for quite a while. IIRC all you need to do is save the latest wslgit.exe release to your computer and then tell VS Code to use it in your settings:

"git.path": "C:\\tools\\wslgit.exe",
@murillorp

This comment has been minimized.

Copy link

murillorp commented Feb 8, 2019

@mmirus Yes, but we want to use this feature without downloading or installing anything on Windows other than WSL itself.

@nickjj

This comment has been minimized.

Copy link

nickjj commented Feb 8, 2019

Keep in mind if you go with the wslgit.exe approach, it works but it's deadly slow. So slow that it's completely unusable (even when things outside of Git was very fast).

@phifa

This comment has been minimized.

Copy link

phifa commented Feb 11, 2019

@joaomoreno is a native integration in VSC planned?

@ruhulwebdev

This comment has been minimized.

Copy link

ruhulwebdev commented Feb 14, 2019

It's 2019.. It's been about 3 years since this issue was brought up... We see no progress at all.

Git with vscode is the only reason I am in linux.. using wsl and git for windows together causes some crazy problems like losing permissions on some folders/files. So please vscode guys do something.

@mmirus

This comment has been minimized.

Copy link

mmirus commented Feb 14, 2019

I know it's not a permanent solution but if you haven't tried wslgit with vscode, give it a shot. It's stable and performs quite well for me.

@phifa

This comment has been minimized.

Copy link

phifa commented Feb 14, 2019

Well I think a heads up would be good. Is it being worked on? Can we contribute or test? Don’t leave us in the dark 🙂

@pd93

This comment has been minimized.

Copy link

pd93 commented Feb 15, 2019

@phifa I think @mmirus is referring to https://github.com/andy-5/wslgit which is an unofficial workaround.

Edit: Some have reported that it's quite slow compared to using Git for Windows, so I still prefer to have both Git for Windows and WSL installed. Only downside is that I have to ensure my SSH keys and .gitconfig are replicated.

Would obviously prefer to stop using Git for Windows though!

@benc-uk

This comment has been minimized.

Copy link

benc-uk commented Feb 18, 2019

wslgit is slow as hell and it's a cludgy workaround.

Also SCM/git is just one part of the WSL integration we need from VSCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment