Skip to content
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

warning: invalid credential line: Opening in existing browser session. #178

Closed
2 of 9 tasks
jglick opened this issue Sep 23, 2020 · 7 comments · Fixed by #180
Closed
2 of 9 tasks

warning: invalid credential line: Opening in existing browser session. #178

jglick opened this issue Sep 23, 2020 · 7 comments · Fixed by #180
Assignees
Labels
bug A bug in Git Credential Manager platform:linux Specific to a Linux-based platform

Comments

@jglick
Copy link

jglick commented Sep 23, 2020

Which version of GCM Core are you using?

Git Credential Manager version 2.0.246-beta+7988edd300 (Linux, .NET Core 3.1.8)

Which Git host provider are you trying to connect to?

  • Azure DevOps
  • Azure DevOps Server (TFS/on-prem)
  • GitHub
  • GitHub Enterprise
  • Bitbucket
  • Other - please describe

Can you access the remote repository directly in the browser using the remote URL?

  • Yes
  • No, I get a permission error
  • No, for a different reason - please describe

Expected behavior

I am authenticated and my Git operation completes successfully.

Actual behavior

I am prompted to authenticate the app in my browser. I do so, and get a confirmation screen saying I may close my tab and go back to the app. But I am still prompted for a password:

$ git push --set-upstream origin master
info: please complete authentication in your browser...
warning: invalid credential line: Opening in existing browser session.
Username for 'https://github.com': jglick
Password for 'https://jglick@github.com': 

If I try again, the same happens, though now the browser tab immediately claims I am already authenticated.

Logs

$ git push --set-upstream origin master
15:13:45.807009 git.c:439               trace: built-in: git push --set-upstream origin master
15:13:45.807820 run-command.c:663       trace: run_command: GIT_DIR=.git git-remote-https origin https://github.com/jglick/push-test.git
15:13:46.107615 run-command.c:663       trace: run_command: 'git credential-manager-core get'
15:13:46.113169 git.c:703               trace: exec: git-credential-manager-core get
15:13:46.113271 run-command.c:663       trace: run_command: git-credential-manager-core get
15:13:46.250683 ...er/Application.cs:69 trace: [RunInternalAsync] Git Credential Manager version 2.0.246-beta+7988edd300 (Linux, .NET Core 3.1.8) 'get'
15:13:46.263230 ...mmands/Command.cs:63 trace: [ExecuteAsync] Start 'get' command...
15:13:46.269457 ...mmands/Command.cs:74 trace: [ExecuteAsync] Detecting host provider for input:
15:13:46.270405 ...mmands/Command.cs:75 trace: [ExecuteAsync] 	protocol=https
15:13:46.270439 ...mmands/Command.cs:75 trace: [ExecuteAsync] 	host=github.com
15:13:46.335712 ...viderRegistry.cs:129 trace: [GetProvider] Performing auto-detection of host provider.
15:13:46.336990 ...mmands/Command.cs:77 trace: [ExecuteAsync] Host provider 'GitHub' was selected.
15:13:46.338796 .../HostProvider.cs:115 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...
15:13:46.687622 .../HostProvider.cs:120 trace: [GetCredentialAsync] No existing credentials found.
15:13:46.687803 .../HostProvider.cs:123 trace: [GetCredentialAsync] Creating new credential...
15:13:46.696188 ...bHostProvider.cs:192 trace: [GetSupportedAuthenticationModesAsync] https://github.com/ is github.com - authentication schemes: 'OAuth'
15:13:46.714110 ...pClientFactory.cs:53 trace: [CreateClient] Creating new HTTP client instance...
info: please complete authentication in your browser...
warning: invalid credential line: Opening in existing browser session.
15:13:47.911601 .../GitHubRestApi.cs:97 trace: [GetUserInfoAsync] HTTP: GET https://api.github.com/user
15:13:47.912061 ...pClientFactory.cs:53 trace: [CreateClient] Creating new HTTP client instance...
15:13:48.167937 ...GitHubRestApi.cs:104 trace: [GetUserInfoAsync] HTTP: Response 200 [OK]
15:13:48.197706 .../HostProvider.cs:125 trace: [GetCredentialAsync] Credential created.
15:13:48.199894 ...mmands/Command.cs:81 trace: [ExecuteAsync] End 'get' command...
Username for 'https://github.com': <Ctrl-C>
@mjcheetham
Copy link
Collaborator

Hi @jglick, thanks for reporting this issue! Can I ask a few questions to help diagnose the problem further?

  1. Which distro and version are you using?
  2. Are you connecting over SSH?
  3. Are you tunnelling a display?
  4. Which browser do you have as your default?
  5. Did the correct browser (the default one) open? If not, which opened?

From first glance, it looks like the browser wrote the line "Opening in existing browser session." to stdout, which git is reading from (and expecting only GCM Core to be writing to). That warning: invalid credential line: part is written by Git, not GCM Core.

It's possible GCM Core may need to launch the browser and detach it from the existing stdin/out.

@mjcheetham mjcheetham added bug A bug in Git Credential Manager platform:linux Specific to a Linux-based platform labels Sep 24, 2020
@jglick
Copy link
Author

jglick commented Sep 24, 2020

Which distro and version are you using?

Ubuntu 20.04, as mentioned initially. Using Xubuntu (XFCE).

Are you connecting over SSH?

To GitHub or my desktop? Neither.

Are you tunnelling a display?

No.

Which browser do you have as your default?

Chromium (snap).

Did the correct browser (the default one) open?

Yes.

the browser wrote the line "Opening in existing browser session." to stdout

Indeed

$ xdg-open https://www.google.com/
Opening in existing browser session.

No such message appears in https://github.com/freedesktop/xdg-utils/blob/0547886c0a7ae79145998495a6e3af6a1450d0c7/scripts/xdg-open.in so I am guessing this is part of Chromium though https://github.com/chromium/chromium/search?q=%22existing+browser+session%22 turns up nothing.

@mjcheetham
Copy link
Collaborator

Thanks for the info @jglick! I'll try and repro this and work out a fix.

@mjcheetham
Copy link
Collaborator

Hi @jglick, I've merged in a fix for this, and tested this using Chromium and now didn't get the extra output written.

The next release will include this fix, or you can build the latest default branch with dotnet build -c LinuxRelease and check inside out/linux/Packaging.Linux/payload/Release.

@mjcheetham
Copy link
Collaborator

Hey @jglick, a pre-release is out with this fix now:

https://github.com/microsoft/Git-Credential-Manager-Core/releases/tag/v2.0.249-beta

@jglick
Copy link
Author

jglick commented Sep 25, 2020

Thanks, it works! After some testing I have decided not to use it, however, because it is noticeably slower than the built-in helper = store: between

git.c:439               trace: built-in: git push

and

git.c:439               trace: built-in: git pack-objects --all-progress-implied --revs --stdout --thin --delta-base-offset --progress

the delay goes up from ~500ms to ~1500ms. It seems the program startup time is a bit slower than a C binary, but most of the time appears to be spent contacting the credentials service:

.../HostProvider.cs:115 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...

to

.../HostProvider.cs:129 trace: [GetCredentialAsync] Existing credential found.

and

.../HostProvider.cs:149 trace: [StoreCredentialAsync] Storing credential with service=https://github.com account=jglick...

to

.../HostProvider.cs:151 trace: [StoreCredentialAsync] Credential was successfully stored.

That second delay (some 50ms) seems particularly silly since there is nothing to store: I am already logged in.

@jglick
Copy link
Author

jglick commented Jul 20, 2021

…and since then I have just switched to gh:

[credential "https://github.com"]
	helper = 
	helper = !/usr/bin/gh auth git-credential

ldennington added a commit that referenced this issue Sep 17, 2021
This version allows us to update existing `winget` manifests by
specifying a manifest's SHA if it already exists in `microsoft/winget-pkgs`.

Pull Requests
---------------

* [#178](mjcheetham/update-winget#179): Allow updatesto existing winget manifests
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Jun 15, 2022
This version allows us to update existing `winget` manifests by
specifying a manifest's SHA if it already exists in `microsoft/winget-pkgs`.

Pull Requests
---------------

* [git-ecosystem#178](mjcheetham/update-winget#179): Allow updates to existing winget manifests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager platform:linux Specific to a Linux-based platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants