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

Inconsistent Authentication Behavior #2025

Closed
1 task done
Eddie-Hartman opened this issue Jan 14, 2019 · 1 comment
Closed
1 task done

Inconsistent Authentication Behavior #2025

Eddie-Hartman opened this issue Jan 14, 2019 · 1 comment
Labels

Comments

@Eddie-Hartman
Copy link

Eddie-Hartman commented Jan 14, 2019

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.20.1.windows.1
cpu: x86_64
built from commit: 7c9fbc07db0e2939b36095df45864b8cda19b64f
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.16299.904]

64 bit windows 10
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
Editor Option: Notepad++
Custom Editor Path: 
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

We've switched organizations on this machine from a corporate login to a local admin account. Not sure if it's relevant. Feel free to ask for more details.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Visual Studio 17, 19 preview, cmd, and git bash all have the same issue. Even TortoiseGit.

git clone https://org@dev.azure.com/org/project/_git/repo

  • What did you expect to occur after running these commands?

To clone the repo down. (No asking for password or anything. Should use microsoft account that's logged into the machine.)

  • What actually happened instead?

A Visual Studio (why?) prompt came up asking for a username and password. After entering the information, it says it was unable to login. The same prompt will come up again. After entering the info, it will say it was unable to log in again. Then an open ssl windows will pop up asking for the password (which I found out is the personal access token). THIS IS INCREDIBLY INCONSISTENT. I've had it ask for the username and password in the Visual Studio prompt once and work, twice and work after the second attempt, or not at all an work, but when it doesn't work I can't seem to do anything to get it working. I don't even understand why a Visual Studio window is popping up to ask for my username and password.

Git was not behaving in this way at all before. It would use my Microsoft account to authenticate and not ask for username and password. It all "just worked". I don't know what would have caused everything to only start working only occasionally and have such inconsistent behavior. This did not immediately start occurring after an update, but still may have been caused by one.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Not specific. (Multiple repos in the same Azure DevOps project)

Update: Some logs that might help

11:05:46.581549 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:05:46.583927 git.c:418               trace: built-in: git clone https://organization@dev.azure.com/organization/BrM/_git/repository
11:05:46.638599 run-command.c:643       trace: run_command: git remote-https origin https://organization@dev.azure.com/organization/BrM/_git/repository
11:05:46.756084 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:05:46.761174 git.c:675               trace: exec: git-remote-https origin https://organization@dev.azure.com/organization/BrM/_git/repository
11:05:46.763213 run-command.c:643       trace: run_command: git-remote-https origin https://organization@dev.azure.com/organization/BrM/_git/repository
11:05:46.901557 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:05:47.154374 run-command.c:643       trace: run_command: 'git credential-manager get'
11:05:47.407941 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:05:47.411328 git.c:675               trace: exec: git-credential-manager get
11:05:47.411328 run-command.c:643       trace: run_command: git-credential-manager get
11:05:47.638866 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.3) 'get'
11:05:47.704879 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
11:05:47.722595 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
11:05:47.905605 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://organization@dev.azure.com/'.
11:05:48.192481 ...uthentication.cs:231 trace: [DetectAuthority] detected 'https://dev.azure.com/organization/' as Azure DevOps from GET response.
11:05:48.193519 ...uthentication.cs:299 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/organization/' is {00000000000000000000000000000000}.
11:05:48.193519 ...uthentication.cs:362 trace: [GetAuthentication] MSA authority detected.
11:05:48.246363 ...\Common.cs:205       trace: [CreateAuthentication] authority for 'https://organization@dev.azure.com/' is Microsoft Live.
11:05:48.246363 ...\Common.cs:765       trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials.
11:05:51.026993 ...\Authority.cs:199    trace: [InteractiveAcquireToken] authority host URL = 'https://login.microsoftonline.com/live.com', token acquisition failed.
11:05:51.026993 ...Authentication.cs:94 trace: [InteractiveLogon] failed to acquire token for 'https://organization@dev.azure.com/'.
11:05:51.026993 ...\Common.cs:854       trace: [QueryCredentials] credentials for 'https://organization@dev.azure.com/' not found.
11:05:51.027993 ...\Common.cs:709       trace: [LogEvent] Failed to retrieve Microsoft Live credentials for 'https://organization@dev.azure.com/'.
11:05:51.029960 ...\Program.cs:414      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
11:05:51.070773 run-command.c:643       trace: run_command: 'git credential-manager get'
11:05:51.231983 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:05:51.234983 git.c:675               trace: exec: git-credential-manager get
11:05:51.234983 run-command.c:643       trace: run_command: git-credential-manager get
11:05:51.414609 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.3) 'get'
11:05:51.491808 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
11:05:51.498401 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
11:05:51.654316 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://organization@dev.azure.com/'.
11:05:51.942677 ...uthentication.cs:231 trace: [DetectAuthority] detected 'https://dev.azure.com/organization/' as Azure DevOps from GET response.
11:05:51.942677 ...uthentication.cs:299 trace: [DetectAuthority] tenant resource for 'https://dev.azure.com/organization/' is {00000000000000000000000000000000}.
11:05:51.944717 ...uthentication.cs:362 trace: [GetAuthentication] MSA authority detected.
11:05:51.988268 ...\Common.cs:205       trace: [CreateAuthentication] authority for 'https://organization@dev.azure.com/' is Microsoft Live.
11:05:51.988268 ...\Common.cs:765       trace: [QueryCredentials] querying 'MicrosoftAccount' for credentials.
11:05:54.121044 ...\Authority.cs:199    trace: [InteractiveAcquireToken] authority host URL = 'https://login.microsoftonline.com/live.com', token acquisition failed.
11:05:54.121044 ...Authentication.cs:94 trace: [InteractiveLogon] failed to acquire token for 'https://organization@dev.azure.com/'.
11:05:54.121044 ...\Common.cs:854       trace: [QueryCredentials] credentials for 'https://organization@dev.azure.com/' not found.
11:05:54.121044 ...\Common.cs:709       trace: [LogEvent] Failed to retrieve Microsoft Live credentials for 'https://organization@dev.azure.com/'.
11:05:54.124027 ...\Program.cs:414      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
11:05:54.168824 run-command.c:643       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
@dscho
Copy link
Member

dscho commented Feb 26, 2019

A Visual Studio (why?) prompt came up asking for a username and password.

Please note that Visual Studio ships with its own Git and Git Credential Manager. To force it to use the same Git Credential Manager as your Git for Windows, you could try something like this:

git config --global credential.helper "C:/Program Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"

i.e. setting credential.helper in your user-wide config to the absolute path of the Git Credential Manager included in Git for Windows.

@dscho dscho added the question label Feb 26, 2019
@dscho dscho closed this as completed Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants