-
-
Notifications
You must be signed in to change notification settings - Fork 303
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
[Bug]: custom Git binary path using wsl doesn't work #141
Comments
I haven't tested it with wsl. I guess the problem is that you first run |
But And since the indirection is required to find git (as it's not just |
Oh ** you are right. Definitely need to fix that. But I still doubt that it works, because the user in the other issue had a local git installation and just wanted to use the wsl installation, which didn't work. Maybe your setup is different and it works nevertheless. |
Released a new version, please try it out. |
Progress! After the update, I'm getting So it looks like something drops the second part of For now, I added an extra I'd love to see the argument-dropping problem fixed eventually (so I no longer need the second wrapper) but it's not urgent. Experiment: To test the argument dropping, I added symlinks named Just for reference, in case others want my full solution for getting WSL's git working: There's a @echo off
C:\Windows\System32\wsl.exe /home/REDACTED/bin/obsidian-git %* and since #!/bin/sh
source ${HOME}/.profile > /dev/null 2>&1 # this is where my config does the ssh-agent connecting
git "$@" and in case you don't have an automated |
(Also I guess @maximberezin97 might want to know that there was indeed a problem and it mostly works now. Oh and thanks for the quick help too, Vinzent!) |
Sorry to hear that it still doesn't work. I'm just providing the path to the simple-git library, so it has to be an issue on their side. I'm really thankful for your workarounds for both Windows and Linux! Should help other people facing the same issue. |
Thank you so much @229c9cf0 , this solution worked for me! I created the two helper files The hardest part was getting my |
I am trying to get git in WSL working but I keep getting an error
I setup a The contents
and
From the command prompt in windows I can pass git commands through I have the "Custom Git binary path" set to:
In the dev-console I have run Does anyone have any ideas? The only thing I can think is the space between first and lastname in my windows Users directory is causing issues. EDIT: I applied the changes from #587 and I was able to make progress, but I got another error:
I moved |
@raulvasquez You are using the |
It cannot run the git command when I surround it in |
Hmm I can't get it to work as well. Seems like a bug in simpel-git to me. You'll have to use no space then. |
Haven't used Obsidian in a while, but I've looked into the current iteration of problems as well now. When checking validity of git settings, the plugin currently runs Apparently at some point the behavior of the plugin changed from just working with relative paths or passing paths as arguments (which works fine if Obsidian is in "Windows-land" and I don't have time to dig into the code, and the logs don't contain more information, so that's all I can figure out for now… But maybe that helps someone else. |
Found a silly/stupid workaround: (@raulvasquez) In PowerShell, That creates a folder |
Just noticed activity on this issue - wanted to put in my 2 cents since I have a working solution that satisfies me. My motivation: I want Windows Obsidian to use WSL's git for
The last one is optional, if you don't need your With this setup, Hope this helps! |
Some base path and git binary path issues have been fixed in the last weeks. E.g. #733. Please open a new issue if you still experience issues. |
[note: suspected cause at the very end; skip ahead and come back if that's not it]
I have Git installed in WSL and added a shell script in my home that will take care of connecting to the
ssh-agent
etc. followed by actually running the requested git command. Despite the command working in both PowerShell and plain CMD, Obsidian Git reports "cannot run git command".I have tried both
C:\Windows\System32\wsl.exe /home/REDACTED/bin/ogit
as well as justwsl.exe /home/REDACTED/bin/ogit
orwsl /home/REDACTED/bin/ogit
(in case there's a problem with handling backslashes...)In CMD and PowerShell, both work:
In Obsidian, all variants fail.
So there seems to be some special formatting / adjustment to the command required to make it work when run from Obsidian. (Or maybe it just doesn't work at all?)
While I don't really understand JS & related languages, from a quick scan of the code in src/simpleGit.ts, the following seem strange:
isGitInstalled
,commitAll
, andpush
all appear to hard-code thegit
command; ifisGitInstalled
gatekeeps the running of all other commands, then it's not surprising that nothing worksThe text was updated successfully, but these errors were encountered: