microsoft/scalar

`scalar clone` does not pass TTY to credential store

derrickstolee opened this issue · 4 comments

In a scalar clone operation, it asks the local Git client for credentials for the given URL so it can check the GVFS Protocol config endpoint. However, this is done without passing the TTY information, which causes problems for command-line interactions with GCM Core.

This is particularly acute on Linux over SSH where GCM Core wants to prompt with MFA details.

Specifically, GCM Core throws with this error in the GCM_TRACE logs:

09:32:07.659585 ...enticationBase.cs:86 trace: [ThrowIfTerminalPromptsDisabled] GIT_TERMINAL_PROMPT is 0; terminal prompts have been disabled.

cc: @mjcheetham for awareness.

GCM Core is stopping because GIT_TERMINAL_PROMPT is 0, meaning Git itself is also being told not to prompt.
Not sure if this is something that's auto-detected inside of Git by the presence of a real TTY or a redirected stream, or something Scalar is explicitly setting.

processInfo.EnvironmentVariables["GIT_TERMINAL_PROMPT"] = "0";

It's being explicitly set for all Git commands that Scalar calls.

We may want to move this into the if (!userInteractive) branch just above in that file; if the Git call is supposed to be user interactive, we should probably allow Git (and friends, like GCM) to prompt on the terminal(!).

Fixed in #439