Skip to content

fatal: StandardIn has not been redirected. #1170

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

Closed
ThePlenkov opened this issue Mar 28, 2023 · 3 comments · Fixed by #1177
Closed

fatal: StandardIn has not been redirected. #1170

ThePlenkov opened this issue Mar 28, 2023 · 3 comments · Fixed by #1177
Labels
auth-issue An issue authenticating to a host

Comments

@ThePlenkov
Copy link

Version

2.0.975+eefca3810d

Operating system

Linux

OS version or distribution

Ubuntu 22.04.2 LTS

Git hosting provider(s)

GitLab

Other hosting provider

No response

(Azure DevOps only) What format is your remote URL?

None

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

Giltab popup window appears and session is stored

Actual behavior

Popup window appears but CLI still asks for the password

Logs

WSLENV=$WSLENV:GCM_TRACE:GIT_TRACE GCM_TRACE=1 GIT_TRACE=1 git clone https://gitlab.myorg.com/myproj.git
10:32:15.969990 git.c:439 trace: built-in: git clone https://gitlab.myorg.com/myproj.git
Cloning into 'payops-backend'...
10:32:15.976187 run-command.c:655 trace: run_command: git remote-https origin https://gitlab.myorg.com/myproj.git
10:32:15.978252 git.c:725 trace: exec: git-remote-https origin https://gitlab.myorg.com/myproj.git
10:32:15.978369 run-command.c:655 trace: run_command: git-remote-https origin https://gitlab.myorg.com/myproj.git
10:32:16.137066 run-command.c:655 trace: run_command: '/usr/local/bin/git-credential-manager get'
10:32:16.222419 git.c:439 trace: built-in: git version
10:32:16.273860 git.c:439 trace: built-in: git config --null trace2.eventtarget
10:32:16.279136 git.c:439 trace: built-in: git config --null trace2.normaltarget
10:32:16.281900 git.c:439 trace: built-in: git config --null trace2.perftarget
10:32:16.312648 git.c:439 trace: built-in: git config --null credential.httpProxy
10:32:16.314527 git.c:439 trace: built-in: git config --null http.proxy
10:32:16.333109 git.c:439 trace: built-in: git config --null http.sslBackend
10:32:16.335598 git.c:439 trace: built-in: git config --null http.sslBackend
10:32:16.336950 git.c:439 trace: built-in: git config --null http.sslVerify
10:32:16.338279 git.c:439 trace: built-in: git config --null --type=path http.sslCAInfo
10:32:16.360486 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.0.975.64750
10:32:16.362813 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.13
10:32:16.362860 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
10:32:16.362865 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux MYHOST 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
10:32:16.362872 ...re/Application.cs:99 trace: [RunInternalAsync] AppPath: /usr/local/bin/git-credential-manager
10:32:16.362931 ...e/Application.cs:100 trace: [RunInternalAsync] InstallDir: /usr/local/share/gcm-core/
10:32:16.362951 ...e/Application.cs:101 trace: [RunInternalAsync] Arguments: get
10:32:16.400671 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
10:32:16.409141 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input:
10:32:16.409237 ...GitCommandBase.cs:48 trace: [ExecuteAsync] protocol=https
10:32:16.409242 ...GitCommandBase.cs:48 trace: [ExecuteAsync] host=gitlab.myorg.com
10:32:16.413772 git.c:439 trace: built-in: git config --null --list
10:32:16.416475 ...oviderRegistry.cs:99 trace: [GetProviderAsync] Host provider override was set id='gitlab'
10:32:16.417881 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitLab' was selected.
10:32:16.421248 git.c:439 trace: built-in: git config --null --list
10:32:16.423011 git.c:439 trace: built-in: git config --null credential.namespace
10:32:16.424484 git.c:439 trace: built-in: git config --null --list
10:32:16.425568 git.c:439 trace: built-in: git config --null credential.credentialStore
10:32:16.580027 ...edentialStore.cs:357 trace: [GetGpgPath] Using PATH-located GPG (gpg) executable: /usr/bin/gpg
10:32:16.597821 git.c:439 trace: built-in: git config --null --list
10:32:16.601103 ...bHostProvider.cs:128 trace: [GetSupportedAuthenticationModes] Supported authentication modes override present: Browser
10:32:17.177323 git.c:439 trace: built-in: git config --null --list
10:32:17.178727 git.c:439 trace: built-in: git config --null credential.guiPrompt
10:32:17.180333 git.c:439 trace: built-in: git config --null --list
10:32:17.181163 git.c:439 trace: built-in: git config --null --type=path credential.gitLabHelper
10:32:17.181467 ...nticationBase.cs:150 trace: [TryFindHelperCommand] Using default UI helper: 'GitLab.UI'.
10:32:17.181517 ...nticationBase.cs:181 trace: [TryFindHelperCommand] Found in-box native UI helper: '/usr/local/share/gcm-core/GitLab.UI'
10:32:17.182979 ...enticationBase.cs:40 trace: [InvokeHelperAsync] Starting helper process: /usr/local/share/gcm-core/GitLab.UI prompt --url https://gitlab.myorg.com/ --browser
10:32:17.283198 git.c:439 trace: built-in: git version
10:32:17.301626 git.c:439 trace: built-in: git config --null trace2.eventtarget
10:32:17.303526 git.c:439 trace: built-in: git config --null trace2.normaltarget
10:32:17.305079 git.c:439 trace: built-in: git config --null trace2.perftarget
10:32:25.675953 git.c:439 trace: built-in: git config --null --list
10:32:25.677318 git.c:439 trace: built-in: git config --null credential.interactive
10:32:25.677896 ...pClientFactory.cs:60 trace: [CreateClient] Creating new HTTP client instance...
10:32:25.678936 git.c:439 trace: built-in: git config --null --list
10:32:25.680585 git.c:439 trace: built-in: git config --null credential.httpsProxy
10:32:25.681498 git.c:439 trace: built-in: git config --null --list
10:32:25.682383 git.c:439 trace: built-in: git config --null credential.httpProxy
10:32:25.683256 git.c:439 trace: built-in: git config --null --list
10:32:25.684061 git.c:439 trace: built-in: git config --null http.proxy
10:32:25.684453 ...ClientFactory.cs:295 trace: [TryCreateProxy] Created a WebProxy instance:
10:32:25.684559 ...ClientFactory.cs:296 trace: [TryCreateProxy] address=http://webproxy.corp.myorg.com:3128/
10:32:25.684591 ...ClientFactory.cs:296 trace: [TryCreateProxy] useDefaultCredentials=true
10:32:25.684599 ...ClientFactory.cs:296 trace: [TryCreateProxy] noProxy=.myorg.com
10:32:25.684614 ...ClientFactory.cs:296 trace: [TryCreateProxy] bypass=(.|://)myorg.com$
10:32:25.684618 ...pClientFactory.cs:66 trace: [CreateClient] HTTP client is using the configured proxy.
10:32:25.685211 git.c:439 trace: built-in: git config --null --list
10:32:25.685978 git.c:439 trace: built-in: git config --null http.sslBackend
10:32:25.686208 ...pClientFactory.cs:80 trace: [CreateClient] Git's SSL/TLS backend is: OpenSsl
10:32:25.686853 git.c:439 trace: built-in: git config --null --list
10:32:25.687640 git.c:439 trace: built-in: git config --null http.sslBackend
10:32:25.688379 git.c:439 trace: built-in: git config --null --list
10:32:25.689882 git.c:439 trace: built-in: git config --null http.sslVerify
10:32:25.691322 git.c:439 trace: built-in: git config --null --list
10:32:25.692383 git.c:439 trace: built-in: git config --null --type=path http.sslCAInfo
10:32:25.695409 git.c:439 trace: built-in: git config --null --list
10:32:25.697750 git.c:439 trace: built-in: git config --null --list
10:32:25.698771 git.c:439 trace: built-in: git config --null credential.gitLabDevRedirectUri
10:32:25.764266 git.c:439 trace: built-in: git config --null --list
info: please complete authentication in your browser...
10:32:27.035464 ...bHostProvider.cs:208 trace: [GetCredentialAsync] Pre-emptively storing OAuth access and refresh tokens...
fatal: StandardIn has not been redirected.
at System.Diagnostics.Process.get_StandardInput()
at GitCredentialManager.ChildProcess.get_StandardInput()
at GitCredentialManager.Gpg.EncryptFile(String path, String gpgId, String contents)
at GitCredentialManager.Interop.Posix.GpgPassCredentialStore.SerializeCredential(FileCredential credential)
at GitCredentialManager.PlaintextCredentialStore.AddOrUpdate(String service, String account, String secret)
at GitCredentialManager.CredentialStore.AddOrUpdate(String service, String account, String secret)
at GitLab.GitLabHostProvider.GetCredentialAsync(InputArguments input)
at GitCredentialManager.Commands.GetCommand.ExecuteInternalAsync(InputArguments input, IHostProvider provider)
at GitCredentialManager.Commands.GitCommandBase.ExecuteAsync()
at System.CommandLine.Invocation.CommandHandler.GetExitCodeAsync(Object value, InvocationContext context)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<b__0>d.MoveNext()
Username for 'https://gitlab.myorg.com':

@ThePlenkov ThePlenkov added the auth-issue An issue authenticating to a host label Mar 28, 2023
@ThePlenkov
Copy link
Author

I think it happens here:

gpg.StandardInput.Write(contents);

According to documentation:

You must set UseShellExecute to false if you want to set RedirectStandardInput to true. Otherwise, writing to the StandardInput stream throws an exception.

@ThePlenkov
Copy link
Author

Also according to this reply we need to start the child process using Start()

@GokulakrishnanV
Copy link

I have the same issue

mjcheetham added a commit that referenced this issue Apr 4, 2023
Ensure that we actually start processes (and check they have started
correctly) using the new ProcessManager/ChildProcess abstractions.

Fixes #1170
Replaces #1171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-issue An issue authenticating to a host
Projects
None yet
2 participants