desktop / dugite

Elegant bindings for working with Git in your Node applications
MIT License
462 stars 149 forks source link

LOCAL_GIT_DIRECTORY does not interop with WSL Git #229

Closed sprat closed 1 year ago

sprat commented 5 years ago

I use WSL to provide a Linux environment into my Windows box.

I use atom on windows to edit files to be used inside the WSL environment and I keep having permissions issues in git because Atom on Windows use the embedded git.exe executable from dugite, whereas I would like to use the git binary from the WSL environment.

Looking at the git-environment.ts file, I see no way to configure the git binary path: even if I set the LOCAL_GIT_DIRECTORY environment variable, the rest of the path to the git binary is not configurable.

FYI, to use Git from the WSL environment, I have a git.cmd script somewhere in my home directory that just call bash.exe -c "git %*"

shiftkey commented 5 years ago

@sprat thanks for the feedback.

that just call bash.exe -c "git %*"

This is the core of the difference between the two environments - the shell where the git command is being executed. The LOCAL_GIT_DIRECTORY escape hatch only supports using a different Git installation, not switching the shell where this is being executed.

I'm not currently interested in enhancing LOCAL_GIT_DIRECTORY so that it will happily bridge to WSL, but I'm happy to use this issue to track interest in the area.

I use atom on windows to edit files to be used inside the WSL environment and I keep having permissions issues in git

Can you share an example of what these errors look like? I'd love for this to Just Work™, and maybe there's something in how I'm launching the embedded git.exe here that can improve this area.

sprat commented 5 years ago

There are issues when you use both Git for Windows and Git for Linux on the same git working directory: if you set permissions on WSL Linux, they are not reflected on Windows and vice versa. I guess that's a WSL-specific problem, but I wanted to solve it by using Git for Linux everywhere.

Meanwhile, I've taken the opposite way, i.e. I use Git for Windows everywhere since it's the only thing possible which dugite currently.

I understand that it's not straightforward to support WSL's git in the current implementation of git-environment.ts, so I'm fine with your decision.