-
Notifications
You must be signed in to change notification settings - Fork 400
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
credential helpers don't work on Windows if sh is not in the path #274
Comments
I think that credential helpers are defined by git as shell scripts, right? Is there anything this library can do if |
My personal preference is that git2-rs would behave the same as the standard git command. It should only try to use I think it would also be useful if git2-rs would relay a better error message when the credential helper fails. Currently the error gets eaten (cred.rs) which makes it difficult to diagnose what went wrong. |
Yeah, can't do much without
|
Not necessarily a dealbreaker, but it turns out that git/run-command.c punts to
|
https://github.com/alexcrichton/git2-rs/blob/047c984d3b934e536fd4cdd54a691ceb233ce92a/src/cred.rs#L293
This requires
sh
to be in the path. My recent git installation from git-scm.org seems to deliberately not add it. Changing the code to call the helper usingcmd /c
makes it work for my specific case which ends up callinggit credential-store get
. This discussion in cargo-test rust-lang/cargo#4609 seems to suggest that usingsh
to run the helper is to allow shell expansion, so not calling it might not be an option. (The git manpage does say "The resulting string is executed by the shell.")It's not clear how to fix this. Always using
cmd /c
will probably break someone's path handling. Falling back fromsh -c
tocmd /c
ifsh
is not available will probably make it even harder to work out what is going on if you are using a helper that contains a path and you get a failure.I'd like to have a solution that does something automatic like bypassing
sh
if it is not required, but maybe the right thing to do is to just display a nicer error if a credential helper is set up butsh
is not in the path?End user failure: rust-lang/cargo#3487
cc: @ehuss
The text was updated successfully, but these errors were encountered: