microsoft / Git-Credential-Manager-for-Windows

Secure Git credential storage for Windows with support for Visual Studio Team Services, GitHub, and Bitbucket multi-factor authentication.
Other
2.87k stars 589 forks source link

Prompted Every Time for Bitbucket Credentials #725

Open mesbahamin opened 6 years ago

mesbahamin commented 6 years ago

Summary

Details

Context

$ git version
git version 2.18.0.windows.1

$ git credential-manager version
Git Credential Manager for Windows version 1.17.1

Steps

Credential manager shows no credentials related to bitbucket:

$ cmdkey.exe /list

Currently stored credentials:

* NONE *

I set up logging and clone my repo:

$ $Env:GIT_TRACE = "%UserProfile%\git.log"
$ $Env:GCM_TRACE = "%UserProfile%\git.log"
$ git clone https://www.bitbucket.org/myorganization/myrepo.git
Cloning into 'myrepo'...
Logon failed, use ctrl+c to cancel basic credential prompt.
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://bitbucket.org': my@email.com
Password for 'https://my@email.com@bitbucket.org':
warning: redirecting to https://bitbucket.org/myorganization/myrepo.git/
remote: Counting objects: 1114, done.
Receiving objects: 100% (1114/1114), 123.65 MiB | 3.68 MiB/s, done.100% (1114/1114), 123.40 MiB | 3.69 MiB/s

Resolving deltas: 100% (519/519), done.
Checking out files: 100% (135/135), done.
Username for 'https://www.bitbucket.org': my@email.com
Password for 'https://my@email.com@www.bitbucket.org':
Username for 'https://bitbucket.org': my@email.com
Password for 'https://my@email.com@bitbucket.org':
Filtering content: 100% (64/64), 35.44 MiB | 766.00 KiB/s, done.

I had to enter my credentials 3 times. Here's what Windows Credential Manager was storing after I entered them the first time:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my@email.com@bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

The output was the same after the second time. Here's what it was after the third time:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my@email.com@bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

    Target: LegacyGeneric:target=git:https://my@email.com@www.bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

Even with these credentials stored in Windows Credential Manager, I had to enter them again 3 times when I re-cloned the same repository:

$ git clone https://www.bitbucket.org/myorganization/myrepo.git
Cloning into 'myrepo'...
Logon failed, use ctrl+c to cancel basic credential prompt.
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://bitbucket.org': my@email.com
Password for 'https://my@email.com@bitbucket.org':
warning: redirecting to https://bitbucket.org/myorganization/myrepo.git/
remote: Counting objects: 1114, done.
Receiving objects: 100% (1114/1114), 123.65 MiB | 3.00 MiB/s, done.100% (1114/1114), 123.57 MiB | 4.87 MiB/s

Resolving deltas: 100% (519/519), done.
Checking out files: 100% (135/135), done.
Username for 'https://www.bitbucket.org': my@email.com
Password for 'https://my@email.com@www.bitbucket.org':
Username for 'https://bitbucket.org': my@email.com
Password for 'https://my@email.com@bitbucket.org':
Filtering content: 100% (64/64), 35.44 MiB | 539.00 KiB/s, done.

Logs

First clone

15:48:29.418813 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
15:48:29.420813 git.c:415               trace: built-in: git clone https://www.bitbucket.org/myorganization/myrepo.git
15:48:29.529819 run-command.c:637       trace: run_command: git remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:48:29.653824 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:29.656824 git.c:654               trace: exec: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:48:29.656824 run-command.c:637       trace: run_command: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:48:29.782830 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:31.106890 run-command.c:637       trace: run_command: 'git credential-manager get'
15:48:31.816923 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:31.818924 git.c:654               trace: exec: git-credential-manager get
15:48:31.818924 run-command.c:637       trace: run_command: git-credential-manager get
15:48:32.089937 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:48:32.264944 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:48:32.273945 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:48:32.281945 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:48:32.406019 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:48:32.881410 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:48:32.881410 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:48:32.904430 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:48:32.907428 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:48:32.941454 run-command.c:637       trace: run_command: 'git credential-manager get'
15:48:33.082565 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:33.085567 git.c:654               trace: exec: git-credential-manager get
15:48:33.085567 run-command.c:637       trace: run_command: git-credential-manager get
15:48:33.270716 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:48:33.424838 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:48:33.433848 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:48:33.441854 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:48:33.561951 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:48:34.044339 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:48:34.045339 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:48:34.066356 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:48:34.069359 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:48:34.262513 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:48:49.189790 run-command.c:637       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'
15:48:55.066623 run-command.c:637       trace: run_command: 'git credential-manager store'
15:48:55.274617 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:55.277618 git.c:654               trace: exec: git-credential-manager store
15:48:55.277618 run-command.c:637       trace: run_command: git-credential-manager store
15:48:55.512611 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:48:55.685607 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:48:55.695605 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:48:55.704606 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:48:55.787603 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:48:56.274590 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:48:56.274590 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:48:56.274590 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:48:56.318589 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:48:56.397590 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:48:56.443584 run-command.c:637       trace: run_command: 'git credential-manager store'
15:48:56.622578 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:56.625580 git.c:654               trace: exec: git-credential-manager store
15:48:56.625580 run-command.c:637       trace: run_command: git-credential-manager store
15:48:57.202237 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:48:57.396349 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:48:57.408232 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:48:57.423231 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:48:57.570227 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:48:58.252209 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:48:58.252209 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:48:58.252209 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:48:58.283208 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:48:58.284208 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:48:58.294208 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:48:58.373236 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:48:58.416203 run-command.c:637       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
15:48:58.490202 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:58.495201 git.c:415               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
15:48:58.891190 run-command.c:637       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 9084 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
15:48:59.011187 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:48:59.014187 git.c:415               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 9084 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
15:49:12.680397 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
15:49:12.681398 git.c:415               trace: built-in: git version
15:49:14.023940 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
15:49:14.024941 git.c:415               trace: built-in: git help -a
15:49:48.775279 run-command.c:637       trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
15:49:48.867279 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:49:48.870278 git.c:415               trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
15:49:48.997278 run-command.c:637       trace: run_command: 'git-lfs filter-process'
15:49:49.328353 trace git-lfs: exec: git 'version'
15:49:49.586275 trace git-lfs: exec: git 'config' '-l'
15:49:49.706274 trace git-lfs: Install hook: pre-push, force=false, path=C:\Users\myusername\myrepo\.git\hooks\pre-push
15:49:49.709274 trace git-lfs: Install hook: post-checkout, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-checkout
15:49:49.711274 trace git-lfs: Install hook: post-commit, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-commit
15:49:49.729274 trace git-lfs: Install hook: post-merge, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-merge
15:49:49.734274 trace git-lfs: Initialize filter-process
15:49:49.734274 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
15:49:49.854288 trace git-lfs: tq: running as batched queue, batch size of 100

[...] REDACTED: Many lines like these:
15:49:49.857276 trace git-lfs: filepathfilter: rejecting "some_dir/some_file.txt" via []
15:49:49.857276 trace git-lfs: filepathfilter: accepting "some_dir/some_file.txt"
[...]

15:49:50.192273 trace git-lfs: tq: sending batch of size 54
15:49:50.193273 trace git-lfs: api: batch 54 files
15:49:50.237271 trace git-lfs: HTTP: POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:49:50.622272 trace git-lfs: HTTP: 301
15:49:50.622272 trace git-lfs: api: redirect POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch to https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:49:50.622272 trace git-lfs: HTTP: POST https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:49:50.960269 trace git-lfs: HTTP: 401
15:49:50.960269 trace git-lfs: setting repository access to basic
15:49:50.960269 trace git-lfs: exec: git 'config' '--replace-all' 'lfs.https://www.bitbucket.org/myorganization/myrepo.git/info/lfs.access' 'basic'
15:49:51.241362 trace git-lfs: api: http response indicates "basic" authentication. Resubmitting...
15:49:51.241561 trace git-lfs: creds: git credential fill ("https", "www.bitbucket.org", "")
15:49:51.295267 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:49:51.305299 git.c:415               trace: built-in: git credential fill
15:49:51.311759 run-command.c:637       trace: run_command: 'git credential-manager get'
15:49:51.425282 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:49:51.428272 git.c:654               trace: exec: git-credential-manager get
15:49:51.428272 run-command.c:637       trace: run_command: git-credential-manager get
15:49:51.601282 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:49:51.746278 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:49:51.755283 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:49:51.763279 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:49:51.867266 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://www.bitbucket.org/'.
15:49:52.385261 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:49:52.385261 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://www.bitbucket.org/'  is Bitbucket.
15:49:52.410260 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://www.bitbucket.org/'.
15:49:52.415260 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:49:52.453256 run-command.c:637       trace: run_command: 'git credential-manager get'
15:49:52.603251 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:49:52.606422 git.c:654               trace: exec: git-credential-manager get
15:49:52.606422 run-command.c:637       trace: run_command: git-credential-manager get
15:49:52.821240 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:49:52.970233 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:49:52.979234 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:49:52.987233 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:49:53.091228 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://www.bitbucket.org/'.
15:49:53.604204 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:49:53.604204 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://www.bitbucket.org/'  is Bitbucket.
15:49:53.625204 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://www.bitbucket.org/'.
15:49:53.628204 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:49:53.657201 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:50:05.622666 run-command.c:637       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'
15:50:13.058571 trace git-lfs: Filled credentials for https://www.bitbucket.org/myorganization/myrepo.git
15:50:13.058571 trace git-lfs: HTTP: POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:50:13.135577 trace git-lfs: HTTP: 301
15:50:13.135577 trace git-lfs: api: redirect POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch to https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:50:13.135577 trace git-lfs: creds: git credential fill ("https", "bitbucket.org", "")
15:50:13.201564 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:13.206562 git.c:415               trace: built-in: git credential fill
15:50:13.215562 run-command.c:637       trace: run_command: 'git credential-manager get'
15:50:13.373582 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:13.376564 git.c:654               trace: exec: git-credential-manager get
15:50:13.376564 run-command.c:637       trace: run_command: git-credential-manager get
15:50:13.585566 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:50:13.765566 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:13.776566 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:13.786567 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:13.920566 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:50:14.393570 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:14.393570 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:50:14.418571 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:50:14.421571 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:50:14.448569 run-command.c:637       trace: run_command: 'git credential-manager get'
15:50:14.614571 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:14.617572 git.c:654               trace: exec: git-credential-manager get
15:50:14.618571 run-command.c:637       trace: run_command: git-credential-manager get
15:50:14.845572 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:50:15.018573 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:15.028574 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:15.037573 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:15.130573 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:50:15.629577 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:15.630593 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:50:15.650577 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:50:15.653598 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:50:15.694620 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:50:42.175736 run-command.c:637       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'
15:50:48.490787 trace git-lfs: Filled credentials for https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:50:48.526785 trace git-lfs: HTTP: POST https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:50:48.886788 trace git-lfs: HTTP: 200
15:50:48.886788 trace git-lfs: creds: git credential approve ("https", "bitbucket.org", "")
15:50:48.974788 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:48.978789 git.c:415               trace: built-in: git credential approve
15:50:48.983788 run-command.c:637       trace: run_command: 'git credential-manager store'
15:50:49.106789 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:49.109790 git.c:654               trace: exec: git-credential-manager store
15:50:49.109790 run-command.c:637       trace: run_command: git-credential-manager store
15:50:49.299792 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:50:49.449794 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:49.458792 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:49.466793 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:49.542793 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:50:50.148798 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:50.148798 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:50:50.148798 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:50:50.174797 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:50:50.175798 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:50:50.180798 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:50:50.269802 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:50:50.297797 run-command.c:637       trace: run_command: 'git credential-manager store'
15:50:50.425800 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:50.428799 git.c:654               trace: exec: git-credential-manager store
15:50:50.428799 run-command.c:637       trace: run_command: git-credential-manager store
15:50:50.632801 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:50:50.830803 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:50.842803 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:50.854803 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:50.926803 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:50:51.530807 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:51.530807 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:50:51.530807 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:50:51.628808 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:50:51.629810 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:50:51.687809 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:50:51.856809 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:50:51.886812 trace git-lfs: creds: git credential approve ("https", "www.bitbucket.org", "")
15:50:51.935810 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:51.938810 git.c:415               trace: built-in: git credential approve
15:50:51.941813 run-command.c:637       trace: run_command: 'git credential-manager store'
15:50:52.057812 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:52.060812 git.c:654               trace: exec: git-credential-manager store
15:50:52.061811 run-command.c:637       trace: run_command: git-credential-manager store
15:50:52.303815 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:50:52.538815 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:52.554815 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:52.566816 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:52.658816 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@www.bitbucket.org/'.
15:50:53.199821 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:53.199821 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@www.bitbucket.org/'  is Bitbucket.
15:50:53.199821 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@www.bitbucket.org/'.
15:50:53.238821 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@www.bitbucket.org/
15:50:53.280837 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@www.bitbucket.org' written to store.
15:50:53.306820 run-command.c:637       trace: run_command: 'git credential-manager store'
15:50:53.451823 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:50:53.453822 git.c:654               trace: exec: git-credential-manager store
15:50:53.453822 run-command.c:637       trace: run_command: git-credential-manager store
15:50:53.634823 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:50:53.790826 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:50:53.799825 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:50:53.808825 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:50:53.882826 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@www.bitbucket.org/'.
15:50:54.335830 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:50:54.336829 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@www.bitbucket.org/'  is Bitbucket.
15:50:54.336829 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@www.bitbucket.org/'.
15:50:54.368829 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@www.bitbucket.org' read from store.
15:50:54.369831 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:50:54.375829 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@www.bitbucket.org/
15:50:54.437828 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@www.bitbucket.org' written to store.

[...] REDACTED: many more lines of git-lfs doing various things successfully

Second clone

15:54:14.584594 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
15:54:14.585595 git.c:415               trace: built-in: git clone https://www.bitbucket.org/myorganization/myrepo.git
15:54:14.695598 run-command.c:637       trace: run_command: git remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:54:14.751601 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:14.754599 git.c:654               trace: exec: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:54:14.754599 run-command.c:637       trace: run_command: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
15:54:14.833602 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:16.115639 run-command.c:637       trace: run_command: 'git credential-manager get'
15:54:16.276642 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:16.278639 git.c:654               trace: exec: git-credential-manager get
15:54:16.278639 run-command.c:637       trace: run_command: git-credential-manager get
15:54:16.473645 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:54:16.619648 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:54:16.628650 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:54:16.636650 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:54:16.763653 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:54:17.265667 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:54:17.265667 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:54:17.286668 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:54:17.289668 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:54:17.320666 run-command.c:637       trace: run_command: 'git credential-manager get'
15:54:17.453670 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:17.456671 git.c:654               trace: exec: git-credential-manager get
15:54:17.456671 run-command.c:637       trace: run_command: git-credential-manager get
15:54:17.627676 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:54:17.784679 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:54:17.794681 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:54:17.804682 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:54:17.929684 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:54:18.402697 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:54:18.402697 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:54:18.427698 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:54:18.431698 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:54:18.506698 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:54:44.543422 run-command.c:637       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'
15:54:49.363561 run-command.c:637       trace: run_command: 'git credential-manager store'
15:54:49.677570 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:49.687570 git.c:654               trace: exec: git-credential-manager store
15:54:49.687570 run-command.c:637       trace: run_command: git-credential-manager store
15:54:50.045582 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:54:50.347620 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:54:50.373679 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:54:50.389620 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:54:50.545626 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:54:51.081640 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:54:51.081640 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:54:51.081640 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:54:51.105642 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:54:51.106642 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:54:51.111641 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:54:51.150642 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:54:51.189642 run-command.c:637       trace: run_command: 'git credential-manager store'
15:54:51.336647 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:51.339647 git.c:654               trace: exec: git-credential-manager store
15:54:51.339647 run-command.c:637       trace: run_command: git-credential-manager store
15:54:51.517652 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:54:51.690658 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:54:51.700659 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
15:54:51.711659 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:54:51.789661 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:54:52.242673 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:54:52.242673 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:54:52.242673 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:54:52.277674 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:54:52.279675 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:54:52.284674 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:54:52.326676 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:54:52.369677 run-command.c:637       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
15:54:52.429690 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:52.434676 git.c:415               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
15:54:52.848691 run-command.c:637       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 8716 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
15:54:52.939693 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:54:52.949694 git.c:415               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 8716 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
15:55:36.059184 run-command.c:637       trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
15:55:36.144188 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:36.150188 git.c:415               trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
15:55:36.278192 run-command.c:637       trace: run_command: 'git-lfs filter-process'
15:55:36.580201 trace git-lfs: exec: git 'version'
15:55:36.866210 trace git-lfs: exec: git 'config' '-l'
15:55:36.942213 trace git-lfs: Install hook: pre-push, force=false, path=C:\Users\myusername\myrepo\.git\hooks\pre-push
15:55:36.971213 trace git-lfs: Install hook: post-checkout, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-checkout
15:55:36.973214 trace git-lfs: Install hook: post-commit, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-commit
15:55:36.977214 trace git-lfs: Install hook: post-merge, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-merge
15:55:36.979214 trace git-lfs: Initialize filter-process
15:55:36.979214 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
15:55:37.111382 trace git-lfs: tq: running as batched queue, batch size of 100

[...] REDACTED: Many lines like these:
15:55:37.115218 trace git-lfs: filepathfilter: rejecting "some_dir/some_file.txt" via []
15:55:37.115218 trace git-lfs: filepathfilter: accepting "some_dir/some_file.txt"
[...]

15:55:37.957244 trace git-lfs: tq: sending batch of size 54
15:55:37.960244 trace git-lfs: api: batch 54 files
15:55:38.084247 trace git-lfs: HTTP: POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:55:38.605270 trace git-lfs: HTTP: 301
15:55:38.605270 trace git-lfs: api: redirect POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch to https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:55:38.605270 trace git-lfs: HTTP: POST https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:55:38.924278 trace git-lfs: HTTP: 401
15:55:38.924278 trace git-lfs: setting repository access to basic
15:55:38.924278 trace git-lfs: exec: git 'config' '--replace-all' 'lfs.https://www.bitbucket.org/myorganization/myrepo.git/info/lfs.access' 'basic'
15:55:39.034277 trace git-lfs: api: http response indicates "basic" authentication. Resubmitting...
15:55:39.034277 trace git-lfs: creds: git credential fill ("https", "www.bitbucket.org", "")
15:55:39.121279 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:39.126279 git.c:415               trace: built-in: git credential fill
15:55:39.128279 run-command.c:637       trace: run_command: 'git credential-manager get'
15:55:39.263283 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:39.266284 git.c:654               trace: exec: git-credential-manager get
15:55:39.266284 run-command.c:637       trace: run_command: git-credential-manager get
15:55:39.483291 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:55:39.659296 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:55:39.669339 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:55:39.678296 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:55:39.783299 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://www.bitbucket.org/'.
15:55:40.265315 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:55:40.265315 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://www.bitbucket.org/'  is Bitbucket.
15:55:40.315348 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://www.bitbucket.org/'.
15:55:40.330317 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:55:40.365355 run-command.c:637       trace: run_command: 'git credential-manager get'
15:55:40.603332 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:40.607368 git.c:654               trace: exec: git-credential-manager get
15:55:40.607368 run-command.c:637       trace: run_command: git-credential-manager get
15:55:40.810333 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:55:41.015338 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:55:41.027339 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:55:41.036339 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:55:41.138343 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://www.bitbucket.org/'.
15:55:41.598358 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:55:41.598358 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://www.bitbucket.org/'  is Bitbucket.
15:55:41.622358 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://www.bitbucket.org/'.
15:55:41.625357 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:55:41.651357 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:55:52.024759 run-command.c:637       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'
15:55:57.848873 trace git-lfs: Filled credentials for https://www.bitbucket.org/myorganization/myrepo.git
15:55:57.848873 trace git-lfs: HTTP: POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:55:57.925873 trace git-lfs: HTTP: 301
15:55:57.925873 trace git-lfs: api: redirect POST https://www.bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch to https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:55:57.925873 trace git-lfs: creds: git credential fill ("https", "bitbucket.org", "")
15:55:57.979875 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:57.983875 git.c:415               trace: built-in: git credential fill
15:55:57.998875 run-command.c:637       trace: run_command: 'git credential-manager get'
15:55:58.130880 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:58.133880 git.c:654               trace: exec: git-credential-manager get
15:55:58.133880 run-command.c:637       trace: run_command: git-credential-manager get
15:55:58.345279 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:55:58.504892 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:55:58.513892 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:55:58.522893 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:55:58.628895 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:55:59.171913 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:55:59.171913 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:55:59.196915 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:55:59.199914 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:55:59.228913 run-command.c:637       trace: run_command: 'git credential-manager get'
15:55:59.384921 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:55:59.411014 git.c:654               trace: exec: git-credential-manager get
15:55:59.411014 run-command.c:637       trace: run_command: git-credential-manager get
15:55:59.661990 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:55:59.849936 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:55:59.859936 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:55:59.869938 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:56:00.003940 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
15:56:00.685964 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:56:00.686965 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
15:56:00.720967 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
15:56:00.724967 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:56:00.759967 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:56:20.503784 run-command.c:637       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'
15:56:26.035974 trace git-lfs: Filled credentials for https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:56:26.076992 trace git-lfs: HTTP: POST https://bitbucket.org/myorganization/myrepo.git/info/lfs/objects/batch
15:56:26.440972 trace git-lfs: HTTP: 200
15:56:26.440972 trace git-lfs: creds: git credential approve ("https", "bitbucket.org", "")
15:56:26.539976 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:26.543976 git.c:415               trace: built-in: git credential approve
15:56:26.553976 run-command.c:637       trace: run_command: 'git credential-manager store'
15:56:26.688982 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:26.691981 git.c:654               trace: exec: git-credential-manager store
15:56:26.691981 run-command.c:637       trace: run_command: git-credential-manager store
15:56:26.918987 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:56:27.192997 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:56:27.204998 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:56:27.213998 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:56:27.283000 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:56:27.740014 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:56:27.740014 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:56:27.741015 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:56:27.765015 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:56:27.766016 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:56:27.771016 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:56:27.861021 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:56:27.889018 run-command.c:637       trace: run_command: 'git credential-manager store'
15:56:28.015022 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:28.019022 git.c:654               trace: exec: git-credential-manager store
15:56:28.019022 run-command.c:637       trace: run_command: git-credential-manager store
15:56:28.205029 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:56:28.357033 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:56:28.365034 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:56:28.373034 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:56:28.434036 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
15:56:28.879051 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:56:28.879051 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
15:56:28.879051 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
15:56:28.913051 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
15:56:28.914053 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:56:28.919052 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
15:56:28.965052 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
15:56:29.052053 trace git-lfs: creds: git credential approve ("https", "www.bitbucket.org", "")
15:56:29.098056 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:29.102057 git.c:415               trace: built-in: git credential approve
15:56:29.106060 run-command.c:637       trace: run_command: 'git credential-manager store'
15:56:29.229061 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:29.231061 git.c:654               trace: exec: git-credential-manager store
15:56:29.231061 run-command.c:637       trace: run_command: git-credential-manager store
15:56:29.414068 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:56:29.583072 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:56:29.592073 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:56:29.601073 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:56:29.668075 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@www.bitbucket.org/'.
15:56:30.109090 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:56:30.109090 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@www.bitbucket.org/'  is Bitbucket.
15:56:30.109090 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@www.bitbucket.org/'.
15:56:30.142090 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@www.bitbucket.org' read from store.
15:56:30.143091 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:56:30.148091 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@www.bitbucket.org/
15:56:30.219095 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@www.bitbucket.org' written to store.
15:56:30.246092 run-command.c:637       trace: run_command: 'git credential-manager store'
15:56:30.384098 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:56:30.389098 git.c:654               trace: exec: git-credential-manager store
15:56:30.389098 run-command.c:637       trace: run_command: git-credential-manager store
15:56:30.664109 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:56:30.815113 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:56:30.824112 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 30 entries.
15:56:30.832112 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:56:30.903114 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@www.bitbucket.org/'.
15:56:31.410130 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
15:56:31.411130 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@www.bitbucket.org/'  is Bitbucket.
15:56:31.411130 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@www.bitbucket.org/'.
15:56:31.439133 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@www.bitbucket.org' read from store.
15:56:31.440131 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
15:56:31.444130 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@www.bitbucket.org/
15:56:31.516137 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@www.bitbucket.org' written to store.

[...] REDACTED: many more lines of git-lfs doing various things successfully
mesbahamin commented 6 years ago

I suspect this might be related to #705

whoisj commented 6 years ago

@mesbahamin do you know what this is for?

15:56:30.832112 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.

With interactive = 'never' you should not be prompted at all. Additionally, how certain are you that these prompts are coming from Git and not Git-Lfs? It looks like Git-Lfs is referring to bitbucket.org as www.bitbucket.org, and those are different credential sets (from Git's point-of-view).

OK so let's break this down.

  1. built-in: git clone https://www.bitbucket.org/myorganization/myrepo.git
  2. run_command: git-credential-manager get
  3. [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'. (alert here as www.bitbucket.org != bitbucket.org -- how did this happen?!)
  4. [Get] Logon failed, use ctrl+c to cancel basic credential prompt. (yeah, kind of expected at this point)
  5. run_command: 'git credential-manager get'
  6. run_command: git-credential-manager get (wait what?!)
  7. [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'. (whoa! still the wrong host!!!)
  8. [LoadOperationArguments] interactive = 'never'.
  9. [Get] Logon failed, use ctrl+c to cancel basic credential prompt. (not surprised)
  10. run_command: 'git credential-manager store' (wait what?! 'store' is only called after credentials are used successfully)
  11. run_command: git-credential-manager store (twice? back to back?!)
  12. [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'. (well, this is different)
  13. run_command: 'git credential-manager store' (AGAIN?! how successful were these credentials?!)
  14. [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'. (O... K...)
  15. git-lfs: creds: git credential fill ("https", "www.bitbucket.org", "") (Oh..?)
  16. run_command: git-credential-manager get
  17. [CreateAuthentication] detecting authority type for 'https://www.bitbucket.org/'.
  18. [Get] Logon failed, use ctrl+c to cancel basic credential prompt. (starting to see a pattern here...)

First, when you have a remote for a bitbucket repository you're expected to include the user-info for said remote. It appears like at least part of your remote information lacks this.

Second, I'd hazard a guess that you have multiple clones happening in parallel. Perhaps some of this is noise caused by Git-Lfs doing its thing, I'm not sure.

Third, despite the authentication routine reporting failure (and not sending credentials back to Git), Git is providing credentials to the helper to store -- this is very unexpected. Worse, I do not think that the Bitbucket authority honors the 'store' request as it expects that it just produce them itself anyways AND the round trip is lossy.

/CC @foda

mesbahamin commented 6 years ago

@whoisj Thank you for the detailed response! Hopefully the information in this comment clears out some of the noise. Please let me know if there are any more questions I can answer or things that I can clarify.

interactive = 'never'

@mesbahamin do you know what this is for?

15:56:30.832112 ...\Common.cs:446 trace: [LoadOperationArguments] interactive = 'never'.

Yes. That option is set as per these recommendations.

As it happens, this issue is taking place on a build agent. I have configured interactive = 'never' to prevent modal windows from popping up during builds, and to ensure that we get a line in the build logs like this, rather than the build agent silently hanging:

Logon failed, use ctrl+c to cancel basic credential prompt.

It should be noted that all the logs I am supplying in this issue are captured from my own interactive sessions while logged into the build agent, and not from the automated build agent processes.

Skipping Git LFS

Additionally, how certain are you that these prompts are coming from Git and not Git-Lfs?

Here's what a fresh clone looks like when git-lfs is told to not download the lfs files (detailed log included at the end of this comment):

$ $Env:GIT_LFS_SKIP_SMUDGE = 1
$ git clone https://www.bitbucket.org/myorganization/myrepo.git
Cloning into 'myrepo'...
Logon failed, use ctrl+c to cancel basic credential prompt.
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://bitbucket.org': my@email.com
Password for 'https://my@email.com@bitbucket.org':
warning: redirecting to https://bitbucket.org/myorganization/myrepo.git/
remote: Counting objects: 1114, done.
Receiving objects: 100% (1114/1114), 123.65 MiB | 1.40 MiB/s, done. 99% (1113/1114), 122.72 MiB | 2.28 MiB/s

Resolving deltas: 100% (519/519), done.
Checking out files: 100% (135/135), done.

I only need to enter my credentials once. This suggests that the other 2 promptings in my previous logs were indeed coming from git-lfs, and not git itself.

Note that the state of Windows credentials, both before and after running the above, was:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my@email.com@bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

Narrowing Down the Issue

So it seems that the problem we are considering here is this:

Even with git credentials stored in Windows Credential Manager, I still must enter them once every time I clone my repo.

Logs

Fresh clone without git-lfs downloading anything

12:17:42.910003 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
12:17:42.912002 git.c:415               trace: built-in: git clone https://www.bitbucket.org/myorganization/myrepo.git
12:17:43.181014 run-command.c:637       trace: run_command: git remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
12:17:43.255017 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:17:43.258018 git.c:654               trace: exec: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
12:17:43.258018 run-command.c:637       trace: run_command: git-remote-https origin https://www.bitbucket.org/myorganization/myrepo.git
12:17:43.723038 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:17:45.868130 run-command.c:637       trace: run_command: 'git credential-manager get'
12:17:46.362184 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:17:46.365153 git.c:654               trace: exec: git-credential-manager get
12:17:46.365153 run-command.c:637       trace: run_command: git-credential-manager get
12:17:47.029182 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
12:17:47.172189 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:17:47.180190 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:17:47.189190 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:17:47.291194 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
12:17:48.121231 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:17:48.122232 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
12:17:48.145233 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
12:17:48.148232 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
12:17:48.181234 run-command.c:637       trace: run_command: 'git credential-manager get'
12:17:48.320240 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:17:48.323239 git.c:654               trace: exec: git-credential-manager get
12:17:48.323239 run-command.c:637       trace: run_command: git-credential-manager get
12:17:48.517248 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
12:17:48.661254 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:17:48.670254 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:17:48.679255 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:17:48.796260 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
12:17:52.322416 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:17:52.322416 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
12:17:52.344418 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
12:17:52.347417 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
12:17:52.379418 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'
12:18:02.639864 run-command.c:637       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'
12:18:07.762056 run-command.c:637       trace: run_command: 'git credential-manager store'
12:18:07.934063 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:18:07.937064 git.c:654               trace: exec: git-credential-manager store
12:18:07.937064 run-command.c:637       trace: run_command: git-credential-manager store
12:18:08.154074 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
12:18:08.331081 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:18:08.341082 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:18:08.351082 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:18:08.429086 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
12:18:08.988111 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:18:08.988111 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
12:18:08.988111 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
12:18:09.019111 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
12:18:09.059114 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
12:18:09.085113 run-command.c:637       trace: run_command: 'git credential-manager store'
12:18:09.221119 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:18:09.225132 git.c:654               trace: exec: git-credential-manager store
12:18:09.225132 run-command.c:637       trace: run_command: git-credential-manager store
12:18:09.399128 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
12:18:09.565134 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:18:09.574136 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:18:09.585136 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:18:09.656153 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
12:18:10.619182 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:18:10.620184 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
12:18:10.620184 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
12:18:10.649183 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
12:18:10.650183 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
12:18:10.655184 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
12:18:10.700186 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
12:18:10.755188 run-command.c:637       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
12:18:10.814188 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:18:10.818190 git.c:415               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --check-self-contained-and-connected --cloning https://bitbucket.org/myorganization/myrepo.git/
12:18:11.265210 run-command.c:637       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 880 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
12:18:11.365214 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:18:11.369214 git.c:415               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 880 on DESKTOP-FPDEUCP' --check-self-contained-and-connected --pack_header=2,1114
12:19:41.088734 run-command.c:637       trace: run_command: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
12:19:41.170739 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
12:19:41.174739 git.c:415               trace: built-in: git rev-list --objects --stdin --not --all --quiet '--progress=Checking connectivity'
12:19:41.290743 run-command.c:637       trace: run_command: 'git-lfs filter-process'
12:19:41.880769 trace git-lfs: exec: git 'version'
12:19:42.312789 trace git-lfs: exec: git 'config' '-l'
12:19:42.445795 trace git-lfs: Install hook: pre-push, force=false, path=C:\Users\myusername\myrepo\.git\hooks\pre-push
12:19:42.453794 trace git-lfs: Install hook: post-checkout, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-checkout
12:19:42.460795 trace git-lfs: Install hook: post-commit, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-commit
12:19:42.468795 trace git-lfs: Install hook: post-merge, force=false, path=C:\Users\myusername\myrepo\.git\hooks\post-merge
12:19:42.477796 trace git-lfs: Initialize filter-process
12:19:42.477796 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
12:19:42.547511 trace git-lfs: tq: running as batched queue, batch size of 100

[...] REDACTED: Many lines like these, which git-lfs still runs even though it won't download anything:
15:55:37.115218 trace git-lfs: filepathfilter: rejecting "some_dir/some_file.txt" via []
15:55:37.115218 trace git-lfs: filepathfilter: accepting "some_dir/some_file.txt"
[...]
mesbahamin commented 6 years ago

Perhaps this is #704 and #710 arising from the depths even after #720 ?

whoisj commented 6 years ago

Let me say this, before anything else: this is wonderfully crafted ticket - thank you very much for taking the time to do it right. πŸ˜€πŸ™‡β€β™‚οΈ

OK let's look at these failures individually.

12:17:47.029182 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
12:17:47.172189 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:17:47.180190 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:17:47.189190 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:17:47.291194 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
12:17:48.121231 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:17:48.122232 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
12:17:48.145233 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
12:17:48.148232 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.

These ones looks like you simply do not have any cached credentials for bitbucket.org, and since interactive = 'never' the GCM cannot prompt.

12:18:08.154074 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
12:18:08.331081 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
12:18:08.341082 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 19 entries.
12:18:08.351082 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
12:18:08.429086 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
12:18:08.988111 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
12:18:08.988111 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
12:18:08.988111 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
12:18:09.019111 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
12:18:09.059114 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.

These ones appears to have succeeded, most likely because you've correctly setup your remote URL with {username}@bitbucket.org, which is expected by the Bitbucket authority.

So I'd hazard a guess that you have remote URL set. One with the username value in the URL (expected by Bitbucket) and one without. Updating the one without will likely resolve the issue for you.

mesbahamin commented 6 years ago

thank you very much for taking the time to do it right.

@whoisj And thank you for taking the time to help me get to the bottom of this :). This comment is a lot of text, but hopefully will contribute.

More Tests

I did some more tests to try and clarify what's happening and remove even more irrelevant variables. I wanted to find out whether this issue was unique to Bitbucket repos, so I made sure to go through my test procedure (see below) with a private GitHub repo as well. I found that behavior with the Bitbucket repo was different depending on whether or not my git configuration included:

[credential]
    interactive = never

Procedure

  1. Clear all credentials from Windows Credential Manager
  2. Clone the repository, entering credentials when prompted
  3. Examine which credentials are present in Windows Credential Manager
  4. Clone the repository again, taking note of whether or not I am prompted again for my credentials

Notable Details

Results

My findings are summarized in this table:

Test # Host interactive = never # Relevant Items in WCM After Cred Prompt Subsequent Clone Prompted for Credentials
1 Bitbucket true 1 true
2 Bitbucket false 2 false
3 GitHub true 1 false
4 GitHub false 1 false

The logs for each of these tests are included at the end of this comment.

Note that when credential.interactive = never isn't present, I'm prompted by a gui window to enter my credentials. When it is present, I get a text prompt. This is, of course, expected.

We can see that GitHub behaves consistently regardless of the credential.interactive setting. One GitHub credential ends up being stored in WCM after I enter my creds, whether I enter them through the GUI prompt window or through the textual terminal prompt. When I clone a second time, that credential is retrieved and used automatically. I don't have to enter my creds a second time. This behavior is what I expect.

Bitbucket, however, behaves inconsistently. When I enter my creds through the GUI prompt, 2 Bitbucket credentials are stored in WCM. When I enter them through the text prompt, only 1 is stored, and it seems inadequate because my subsequent clone requires me to re-enter my creds. This behavior is unexpected.

Questions

You mentioned:

These ones looks like you simply do not have any cached credentials for bitbucket.org, and since interactive = 'never' the GCM cannot prompt.

Even with interactive = never, I am prompted by (I think) Git Credential Manager for Windows, just textually rather than with a GUI. So I'm confused that the results are different.

You also mentioned:

These ones appears to have succeeded, most likely because you've correctly setup your remote URL with {username}@bitbucket.org, which is expected by the Bitbucket authority.

I was confused when I read this because I'm using the same URL with each invocation of git clone. Which remote URL are you referring to? Is it the URL stored with the credential in WCM?

Yet another thing I noticed is that WCM credentials end up having slight differences in the User: field depending on whether interactive = never is present in the git config. This is true even with GitHub (see the logs for tests 3 and 4 below). Not sure whether this is not relevant.

@whoisj Thank you again for your help with this issue.

Logs

Test 1

(Bitbucket, text cred prompt, unexpected behavior)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
14:45:03.730187 git.c:344               trace: built-in: git 'clone' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:45:03.765093 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:45:03.777063 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:45:03.777063 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:45:04.835575 run-command.c:626       trace: run_command: 'git credential-manager get'
14:45:04.868486 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:45:04.868486 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:45:04.921345 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:45:04.989163 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:45:04.993154 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:45:04.997142 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:45:05.038061 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:45:05.467022 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:45:05.467022 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:45:05.474977 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
14:45:05.475975 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
14:45:05.501905 run-command.c:626       trace: run_command: 'git credential-manager get'
14:45:05.533844 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:45:05.533844 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:45:05.584684 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:45:05.637574 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:45:05.641534 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:45:05.644524 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:45:05.686440 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:45:06.101344 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:45:06.101344 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:45:06.109324 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
14:45:06.110321 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
14:45:06.136250 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
14:45:21.959835 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
14:45:26.187412 run-command.c:626       trace: run_command: 'git credential-manager store'
14:45:26.221322 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:45:26.221322 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:45:26.277173 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:45:26.331029 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:45:26.335018 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:45:26.338010 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:45:26.365935 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
14:45:26.793053 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:45:26.793053 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
14:45:26.793053 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
14:45:26.803026 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
14:45:26.809010 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
14:45:26.833944 run-command.c:626       trace: run_command: 'git credential-manager store'
14:45:26.861869 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:45:26.862867 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:45:26.914729 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:45:26.971575 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:45:26.975582 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:45:26.978578 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:45:27.007479 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
14:45:27.414429 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:45:27.414429 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
14:45:27.414429 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
14:45:27.427422 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
14:45:27.428392 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:45:27.429389 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
14:45:27.436399 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
14:45:27.463298 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:45:27.475267 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:45:27.959088 run-command.c:626       trace: run_command: 'unpack-objects' '--pack_header=2,29'
14:45:27.972053 git.c:344               trace: built-in: git 'unpack-objects' '--pack_header=2,29'
14:45:28.100709 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
14:45:28.112678 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my@email.com@bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence
14:47:01.215159 git.c:344               trace: built-in: git 'clone' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:47:01.249069 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:47:01.261036 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:47:01.261036 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:47:02.348370 run-command.c:626       trace: run_command: 'git credential-manager get'
14:47:02.380280 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:47:02.380280 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:47:02.434164 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:47:02.487016 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:47:02.490984 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:47:02.493997 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:47:02.536861 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:47:02.987680 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:47:02.987680 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:47:02.995635 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
14:47:02.996632 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
14:47:03.012588 run-command.c:626       trace: run_command: 'git credential-manager get'
14:47:03.042510 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:47:03.043506 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:47:03.095368 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:47:03.149247 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:47:03.153213 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:47:03.156205 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:47:03.198093 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:47:03.616145 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:47:03.616145 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:47:03.623129 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
14:47:03.624095 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
14:47:03.649028 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
14:47:14.200185 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
14:47:19.250702 run-command.c:626       trace: run_command: 'git credential-manager store'
14:47:19.324504 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:47:19.324504 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:47:19.377389 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:47:19.432216 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:47:19.435208 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:47:19.439197 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:47:19.471112 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
14:47:19.938130 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:47:19.939127 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
14:47:19.939127 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
14:47:19.947108 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
14:47:19.947108 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:47:19.949101 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
14:47:19.955085 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
14:47:19.981016 run-command.c:626       trace: run_command: 'git credential-manager store'
14:47:20.010936 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:47:20.010936 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:47:20.063824 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:47:20.121640 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:47:20.125656 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
14:47:20.128653 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:47:20.156548 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
14:47:20.570566 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:47:20.570566 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
14:47:20.570566 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
14:47:20.583520 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my@email.com@bitbucket.org' read from store.
14:47:20.584516 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:47:20.586511 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
14:47:20.592494 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.
14:47:20.627408 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:47:20.639391 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:47:20.993443 run-command.c:626       trace: run_command: 'unpack-objects' '--pack_header=2,29'
14:47:21.008399 git.c:344               trace: built-in: git 'unpack-objects' '--pack_header=2,29'
14:47:21.145034 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
14:47:21.155008 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
14:47:21.207867 run-command.c:626       trace: run_command: 'C:\dev\myorganization\asgard\myrepo\githooks/post-checkout' '0000000000000000000000000000000000000000' 'eeffd209d4c70954cf0ee53d5b279dc9f8dfced4' '1'
14:47:21.259727 git.c:576               trace: exec: 'git-lfs' 'post-checkout' '0000000000000000000000000000000000000000' 'eeffd209d4c70954cf0ee53d5b279dc9f8dfced4' '1'
14:47:21.259727 run-command.c:626       trace: run_command: 'git-lfs' 'post-checkout' '0000000000000000000000000000000000000000' 'eeffd209d4c70954cf0ee53d5b279dc9f8dfced4' '1'
14:47:21.286655 trace git-lfs: run_command: 'git' version
14:47:21.358546 trace git-lfs: run_command: 'git' config -l

Test 2

(Bitbucket, gui cred prompt, expected behavior)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
14:35:29.638397 git.c:344               trace: built-in: git 'clone' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:35:29.674301 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:35:29.686269 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:35:29.687267 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:35:30.648505 run-command.c:626       trace: run_command: 'git credential-manager get'
14:35:30.683412 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:35:30.684409 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:35:30.740287 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:35:30.794115 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:35:30.798117 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:35:30.843982 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:35:31.284087 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:35:31.284087 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:35:31.337943 ...icationPrompts.cs:96 trace: [CredentialModalPrompt] prompting user for credentials.
14:35:45.392243 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
14:35:45.392243 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
14:35:45.393240 ...\RestClient.cs:80    trace: [FindUsername] Found username [my_bitbucket_username_that_is_not_an_email_address]
14:35:45.393240 ...hAuthenticator.cs:31 trace: [GetAuthAsync] remote username [my_bitbucket_username_that_is_not_an_email_address] != [my@email.com] supplied username
14:35:45.393240 ...uthentication.cs:360 trace: [InteractiveLogon] token acquisition succeeded
14:35:45.396232 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://bitbucket.org/
14:35:45.396232 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/
14:35:45.404211 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' written to store.
14:35:45.411210 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://bitbucket.org' written to store.
14:35:45.416179 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
14:35:45.728500 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
14:35:45.728500 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
14:35:45.728500 ...\RestClient.cs:80    trace: [FindUsername] Found username [my_bitbucket_username_that_is_not_an_email_address]
14:35:45.728500 ...\Authority.cs:221    trace: [ValidateCredentials] credential validation succeeded
14:35:45.728500 ...\Common.cs:828       trace: [QueryCredentials] credentials for 'https://bitbucket.org/' found.
14:35:45.728500 ...\Common.cs:642       trace: [LogEvent] Bitbucket credentials for 'https://bitbucket.org/' successfully retrieved.
14:35:46.411771 run-command.c:626       trace: run_command: 'git credential-manager store'
14:35:46.443684 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:35:46.443684 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:35:46.499566 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:35:46.555413 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:35:46.559376 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:35:46.589296 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:35:47.102191 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:35:47.102191 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'  is Bitbucket.
14:35:47.102191 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:35:47.116182 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' read from store.
14:35:47.117179 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:35:47.119146 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/
14:35:47.126165 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' written to store.
14:35:47.153055 run-command.c:626       trace: run_command: 'git credential-manager store'
14:35:47.183972 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:35:47.183972 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:35:47.235834 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:35:47.289690 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:35:47.294676 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:35:47.325593 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:35:47.897865 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:35:47.897865 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'  is Bitbucket.
14:35:47.897865 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:35:47.910831 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' read from store.
14:35:47.911828 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:35:47.913823 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/
14:35:47.920804 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' written to store.
14:35:47.947732 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:35:47.960698 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:35:48.390104 run-command.c:626       trace: run_command: 'unpack-objects' '--pack_header=2,29'
14:35:48.407056 git.c:344               trace: built-in: git 'unpack-objects' '--pack_header=2,29'
14:35:48.542693 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
14:35:48.553663 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://bitbucket.org
    Type: Generic
    User: my_bitbucket_username_that_is_not_an_email_address
    Local machine persistence

    Target: LegacyGeneric:target=git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org
    Type: Generic
    User: my_bitbucket_username_that_is_not_an_email_address
    Local machine persistence
14:38:10.284076 git.c:344               trace: built-in: git 'clone' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:38:10.317985 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:38:10.329954 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:38:10.329954 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.bitbucket.org/myorganization/myrepo.git'
14:38:11.295132 run-command.c:626       trace: run_command: 'git credential-manager get'
14:38:11.328044 git.c:576               trace: exec: 'git-credential-manager' 'get'
14:38:11.328044 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
14:38:11.398882 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:38:11.451713 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:38:11.455702 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:38:11.501579 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:38:11.962542 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:38:11.962542 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:38:11.969524 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://bitbucket.org' read from store.
14:38:11.969524 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:38:11.975507 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
14:38:12.462807 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
14:38:12.462807 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
14:38:12.463807 ...\RestClient.cs:80    trace: [FindUsername] Found username [my_bitbucket_username_that_is_not_an_email_address]
14:38:12.464804 ...\Authority.cs:221    trace: [ValidateCredentials] credential validation succeeded
14:38:12.464804 ...\Common.cs:828       trace: [QueryCredentials] credentials for 'https://bitbucket.org/' found.
14:38:12.464804 ...\Common.cs:642       trace: [LogEvent] Bitbucket credentials for 'https://bitbucket.org/' successfully retrieved.
14:38:12.623401 run-command.c:626       trace: run_command: 'git credential-manager store'
14:38:12.655443 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:38:12.655443 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:38:12.709328 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:38:12.762186 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:38:12.766167 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:38:12.796094 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:38:13.226178 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:38:13.226178 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'  is Bitbucket.
14:38:13.226178 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:38:13.235154 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' read from store.
14:38:13.235154 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:38:13.237149 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/
14:38:13.246125 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' written to store.
14:38:13.271082 run-command.c:626       trace: run_command: 'git credential-manager store'
14:38:13.300005 git.c:576               trace: exec: 'git-credential-manager' 'store'
14:38:13.300005 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
14:38:13.353837 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:38:13.407692 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:38:13.410712 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:38:13.442599 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:38:13.859683 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:38:13.859683 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'  is Bitbucket.
14:38:13.859683 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/'.
14:38:13.872621 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' read from store.
14:38:13.872621 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
14:38:13.874616 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username_that_is_not_an_email_address at https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org/
14:38:13.881634 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username_that_is_not_an_email_address@bitbucket.org' written to store.
14:38:13.909523 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:38:13.921490 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://bitbucket.org/myorganization/myrepo.git/'
14:38:14.341367 run-command.c:626       trace: run_command: 'unpack-objects' '--pack_header=2,29'
14:38:14.354333 git.c:344               trace: built-in: git 'unpack-objects' '--pack_header=2,29'
14:38:14.491964 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
14:38:14.502936 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'

Test 3

(GitHub, text cred prompt, expected behavior)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
15:02:50.306228 git.c:576               trace: exec: 'git-st'
15:02:50.306228 run-command.c:626       trace: run_command: 'git-st'
15:02:50.309223 git.c:274               trace: alias expansion: st => 'status'
15:02:50.309223 git.c:620               trace: exec: 'git' 'status'
15:02:50.309223 run-command.c:626       trace: run_command: 'git' 'status'
15:03:06.942639 git.c:576               trace: exec: 'git-st'
15:03:06.943636 run-command.c:626       trace: run_command: 'git-st'
15:03:06.945630 git.c:274               trace: alias expansion: st => 'status'
15:03:06.945630 git.c:620               trace: exec: 'git' 'status'
15:03:06.945630 run-command.c:626       trace: run_command: 'git' 'status'
15:04:42.313757 git.c:344               trace: built-in: git 'clone' 'https://www.github.com/HandmadeHero/cpp.git'
15:04:42.349662 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:04:42.361630 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:04:42.361630 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:04:43.050965 run-command.c:626       trace: run_command: 'git credential-manager get'
15:04:43.083794 git.c:576               trace: exec: 'git-credential-manager' 'get'
15:04:43.083794 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
15:04:43.139671 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:04:43.191533 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:04:43.196493 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:04:43.199485 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:04:43.242398 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
15:04:43.505801 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
15:04:43.505801 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
15:04:43.510788 ...\Common.cs:809       trace: [QueryCredentials] credentials for 'https://github.com/' not found.
15:04:43.511758 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve GitHub credentials for 'https://github.com/'.
15:04:43.512755 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:04:43.537717 run-command.c:626       trace: run_command: 'git credential-manager get'
15:04:43.568606 git.c:576               trace: exec: 'git-credential-manager' 'get'
15:04:43.568606 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
15:04:43.622462 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:04:43.674323 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:04:43.678340 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:04:43.682301 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:04:43.723192 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
15:04:44.067510 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
15:04:44.067510 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
15:04:44.073494 ...\Common.cs:809       trace: [QueryCredentials] credentials for 'https://github.com/' not found.
15:04:44.073494 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve GitHub credentials for 'https://github.com/'.
15:04:44.074491 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
15:04:44.099424 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
15:05:01.722733 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
15:06:21.106005 run-command.c:626       trace: run_command: 'git credential-manager store'
15:06:21.135925 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:06:21.136923 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:06:21.190807 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:06:21.246638 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:06:21.250619 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:06:21.253611 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:06:21.282533 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@github.com/'.
15:06:21.589741 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://my@email.com@github.com/'.
15:06:21.589741 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://my@email.com@github.com/' is GitHub.
15:06:21.589741 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://my@email.com@github.com/'.
15:06:21.596722 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:06:21.621656 run-command.c:626       trace: run_command: 'git credential-manager store'
15:06:21.651576 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:06:21.652572 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:06:21.704434 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:06:21.761282 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:06:21.765271 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:06:21.769260 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:06:21.796188 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@github.com/'.
15:06:22.065605 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://my@email.com@github.com/'.
15:06:22.066602 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://my@email.com@github.com/' is GitHub.
15:06:22.066602 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://my@email.com@github.com/'.
15:06:22.077572 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:06:22.105498 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:06:22.121456 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:06:22.324929 run-command.c:626       trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 15496 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:06:22.338892 git.c:344               trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 15496 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:06:22.830577 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
15:06:22.841547 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://github.com
    Type: Generic
    User: my@email.com
    Local machine persistence
15:06:53.280875 git.c:344               trace: built-in: git 'clone' 'https://www.github.com/HandmadeHero/cpp.git'
15:06:53.313787 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:06:53.325755 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:06:53.325755 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:06:53.974793 run-command.c:626       trace: run_command: 'git credential-manager get'
15:06:54.006624 git.c:576               trace: exec: 'git-credential-manager' 'get'
15:06:54.006624 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
15:06:54.069457 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:06:54.130311 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:06:54.134284 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:06:54.137303 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:06:54.179164 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
15:06:54.442507 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
15:06:54.442507 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
15:06:54.447466 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://github.com' read from store.
15:06:54.447466 ...uthentication.cs:175 trace: [GetCredentials] credentials for 'https://github.com/' found.
15:06:55.523755 ...\Authority.cs:200    trace: [ValidateCredentials] credential validation for 'https://github.com/' succeeded.
15:06:55.523755 ...\Common.cs:804       trace: [QueryCredentials] credentials for 'https://github.com/' found.
15:06:55.523755 ...\Common.cs:642       trace: [LogEvent] GitHub credentials for 'https://github.com/' successfully retrieved.
15:06:55.764210 run-command.c:626       trace: run_command: 'git credential-manager store'
15:06:55.795126 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:06:55.795126 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:06:55.846988 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:06:55.900844 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:06:55.904833 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:06:55.907825 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:06:55.936748 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@github.com/'.
15:06:56.192202 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://my@email.com@github.com/'.
15:06:56.192202 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://my@email.com@github.com/' is GitHub.
15:06:56.192202 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://my@email.com@github.com/'.
15:06:56.200180 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:06:56.226111 run-command.c:626       trace: run_command: 'git credential-manager store'
15:06:56.256031 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:06:56.256031 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:06:56.308889 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:06:56.366735 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:06:56.370724 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 51 entries.
15:06:56.373716 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
15:06:56.401641 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@github.com/'.
15:06:56.682014 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://my@email.com@github.com/'.
15:06:56.682014 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://my@email.com@github.com/' is GitHub.
15:06:56.682014 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://my@email.com@github.com/'.
15:06:56.693064 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:06:56.731902 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:06:56.744847 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:06:56.949300 run-command.c:626       trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 1852 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:06:56.962265 git.c:344               trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 1852 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:06:58.442477 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
15:06:58.453469 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'

Test 4

(GitHub, gui cred prompt, expected behavior)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
15:13:42.681758 git.c:344               trace: built-in: git 'clone' 'https://www.github.com/HandmadeHero/cpp.git'
15:13:42.717661 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:13:42.729622 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:13:42.729622 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:13:43.649576 run-command.c:626       trace: run_command: 'git credential-manager get'
15:13:43.684403 git.c:576               trace: exec: 'git-credential-manager' 'get'
15:13:43.684403 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
15:13:43.741280 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:13:43.796104 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:13:43.800121 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:13:43.844973 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
15:13:44.102578 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
15:13:44.102578 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
15:13:44.153415 ...icationPrompts.cs:59 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
15:14:00.418671 ...\Authority.cs:101    trace: [AcquireToken] server responded with Created.
15:14:00.419585 ...\Authority.cs:125    trace: [AcquireToken] authentication success: new personal access token for 'https://github.com/' created.
15:14:00.419585 ...uthentication.cs:201 trace: [InteractiveLogon] token acquisition for 'https://github.com/' succeeded
15:14:00.427563 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:14:01.198014 ...\Authority.cs:200    trace: [ValidateCredentials] credential validation for 'https://github.com/' succeeded.
15:14:01.198014 ...\Common.cs:804       trace: [QueryCredentials] credentials for 'https://github.com/' found.
15:14:01.198014 ...\Common.cs:642       trace: [LogEvent] GitHub credentials for 'https://github.com/' successfully retrieved.
15:14:01.897667 run-command.c:626       trace: run_command: 'git credential-manager store'
15:14:01.929499 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:14:01.930496 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:14:01.980390 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:14:02.033248 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:14:02.037238 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:14:02.067160 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://Personal Access Token@github.com/'.
15:14:02.323517 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://Personal Access Token@github.com/'.
15:14:02.323517 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://Personal Access Token@github.com/' is GitHub.
15:14:02.323517 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://Personal Access Token@github.com/'.
15:14:02.334650 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:14:02.360584 run-command.c:626       trace: run_command: 'git credential-manager store'
15:14:02.392498 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:14:02.392498 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:14:02.446363 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:14:02.502205 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:14:02.506194 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:14:02.538109 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://Personal Access Token@github.com/'.
15:14:02.797121 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://Personal Access Token@github.com/'.
15:14:02.797121 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://Personal Access Token@github.com/' is GitHub.
15:14:02.798118 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://Personal Access Token@github.com/'.
15:14:02.808092 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:14:02.844994 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:14:02.858956 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:14:03.074492 run-command.c:626       trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 11916 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:14:03.087457 git.c:344               trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 11916 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:14:06.890257 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
15:14:06.902225 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://github.com
    Type: Generic
    User: Personal Access Token
    Local machine persistence
15:14:26.043058 git.c:344               trace: built-in: git 'clone' 'https://www.github.com/HandmadeHero/cpp.git'
15:14:26.077965 run-command.c:626       trace: run_command: 'remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:14:26.090930 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:14:26.090930 run-command.c:626       trace: run_command: 'git-remote-https' 'origin' 'https://www.github.com/HandmadeHero/cpp.git'
15:14:26.648617 run-command.c:626       trace: run_command: 'git credential-manager get'
15:14:26.680507 git.c:576               trace: exec: 'git-credential-manager' 'get'
15:14:26.680507 run-command.c:626       trace: run_command: 'git-credential-manager' 'get'
15:14:26.732389 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
15:14:26.785231 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:14:26.789246 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:14:26.834124 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
15:14:27.116415 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
15:14:27.116415 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
15:14:27.122395 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://github.com' read from store.
15:14:27.122395 ...uthentication.cs:175 trace: [GetCredentials] credentials for 'https://github.com/' found.
15:14:27.780373 ...\Authority.cs:200    trace: [ValidateCredentials] credential validation for 'https://github.com/' succeeded.
15:14:27.780373 ...\Common.cs:804       trace: [QueryCredentials] credentials for 'https://github.com/' found.
15:14:27.780373 ...\Common.cs:642       trace: [LogEvent] GitHub credentials for 'https://github.com/' successfully retrieved.
15:14:28.172450 run-command.c:626       trace: run_command: 'git credential-manager store'
15:14:28.204386 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:14:28.204386 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:14:28.256223 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:14:28.310106 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:14:28.313098 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:14:28.343987 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://Personal Access Token@github.com/'.
15:14:28.590463 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://Personal Access Token@github.com/'.
15:14:28.590463 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://Personal Access Token@github.com/' is GitHub.
15:14:28.591464 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://Personal Access Token@github.com/'.
15:14:28.599415 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:14:28.625345 run-command.c:626       trace: run_command: 'git credential-manager store'
15:14:28.656263 git.c:576               trace: exec: 'git-credential-manager' 'store'
15:14:28.657260 run-command.c:626       trace: run_command: 'git-credential-manager' 'store'
15:14:28.709122 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
15:14:28.762998 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
15:14:28.767964 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
15:14:28.798882 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://Personal Access Token@github.com/'.
15:14:29.068378 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://Personal Access Token@github.com/'.
15:14:29.068378 ...\Common.cs:162       trace: [CreateAuthentication] authority for 'https://Personal Access Token@github.com/' is GitHub.
15:14:29.068378 ...\Program.cs:527      trace: [Store] storing GitHub credentials for 'https://Personal Access Token@github.com/'.
15:14:29.080353 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://github.com' written to store.
15:14:29.111264 run-command.c:626       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:14:29.125226 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github.com/HandmadeHero/cpp.git/'
15:14:29.308985 run-command.c:626       trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 15996 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:14:29.322948 git.c:344               trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 15996 on cooper' '--check-self-contained-and-connected' '--pack_header=2,5012'
15:14:33.634049 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
15:14:33.645019 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet' '--progress=Checking connectivity'
benyaminl commented 6 years ago

I can't even authenticate with bitbucket.. they screw everything lately without any notice... Always cause login failed even with new GCW 1.17

C:\Users\Ben>git clone https://Xxx@bitbucket.org/xxx/xxxx.git Cloning into 'xxxx... Logon failed, use ctrl+c to cancel basic credential prompt. Password for 'https://xxxx@bitbucket.org': remote: Counting objects: 817

codekaizen commented 6 years ago

Git 2.18 broken for me, too in the same way. I reverted to git 2.16.3 and I can sign in with the (old) Atlassian credential dialog via GCW.

whoisj commented 6 years ago

/CC @foda @mminns

@benyaminl and @codekaizen could you capture trace logs similar to what @mesbahamin was kind enough to provide? They are invaluable when attempting to resolve issues for you.

mesbahamin commented 6 years ago

@whoisj In an attempt to answer some of the questions I listed in my last post, I cloned and built Git Credential Manager for Windows locally and told git to use this local build as its credential helper.

Unfortunately I didn't quite manage to get to the point where I could step through the code in VS when git invoked GCM. I may be able to put more time into this, and will report here if I find anything notable.

whoisj commented 6 years ago

@mesbahamin if you set GCM_DEBUG=1 the GCM will reach out to your debugger for help.

Of course, this works best with a debug build of the project, so using your local built GCM is likely the best solution if you plan to debug the project.

Thanks so much for your continued patience and effort! πŸ™‡β€β™‚οΈπŸ‘

whoisj commented 6 years ago

Even with interactive = never, I am prompted by (I think) Git Credential Manager for Windows, just textually rather than with a GUI. So I'm confused that the results are different.

The source code governing that interaction is below, and I'm very surprised to find that the condition allows Interactivity == Never to call the AcquireCredentials API.

if (((operationArguments.Interactivity != Interactivity.Always)
        && ((credentials = await bbcAuth.GetCredentials(operationArguments.TargetUri, operationArguments.Username)) != null)
        && (!operationArguments.ValidateCredentials
            || ((credentials = await bbcAuth.ValidateCredentials(operationArguments.TargetUri, operationArguments.Username, credentials)) != null)))
    || ((operationArguments.Interactivity != Interactivity.Never)
        && ((credentials = await bbcAuth.InteractiveLogon(operationArguments.TargetUri, operationArguments.Username)) != null)
        && (!operationArguments.ValidateCredentials
            || ((credentials = await bbcAuth.ValidateCredentials(operationArguments.TargetUri, operationArguments.Username, credentials)) != null))))

/CC @Foda - perhaps he can help explain why we're seeing a pair of credentials being saved off. Perhaps one of them is the "refresh token"?

whoisj commented 6 years ago

Git 2.18 broken for me, too in the same way. I reverted to git 2.16.3 and I can sign in with the (old) Atlassian credential dialog via GCW.

@codekaizen I do not believe there's a GCM change between v2.17 and v2.18 of Git for Windows, it's a separate project and they keep their own schedule as to when various components update and they also control to what version of the component their package is updated to.

For the purposes of this issue tracker you should be concerned with the output of git credential-manager version and not git version; though the two can interplay, for this issue they do not.

benyaminl commented 6 years ago

@whoisj It's working after useing GCW 1.17.1 (Sorry for not looking the release, I've seen that there's problem on milestone, thanks for fix it for user like us). I use busybox git version, the very minimal version of git on windows

whoisj commented 6 years ago

@benyamini please be aware that Minimal Git for Windows is not designed to be used directly by people. It is intended to be used as part of a GUI application. For example : Visual Studio ships with and exclusively uses Minimal Git for Windows.

You can make it work on the command line, but you're on your own if / when things fail.

benyaminl commented 6 years ago

@whoisj Yep I just told by other developer the same way. I use it with VS Code :) Anyway it's working for now (I hate git with very big footprint on memory, that's why I use MinGit, and It's portable :))

mesbahamin commented 6 years ago

After some additional time spent investigating this (with he help of GCM_DEBUG and the Visual Studio debugger), I think I may have some useful observations.

Username vs. Email Address

First, some words about the current state of Bitbucket authentication.

Bitbucket has the concept of an account with a username and an email. In the following discussion and logs, I will use "my_bitbucket_username" and "my@email.com" as example values for each, respectively.

For the purpose of Bitbucket authentication, these used to be interchangeable (the way they are with GitHub or GitLab). At some point, Atlassian changed this. Since that change, users have only been permitted to authenticate with their email, not their username. You can see this if you try to log in to Bitbucket with your username:

Screenshot of Bitbucket rejecting my username and requiring my email

Because of this policy, I have gotten used to using only my email to authenticate with Bitbucket.

I wondered whether perhaps this issue (#725) had been caused by some subtle bug having to do with my use of my email address rather than my username. I did some more experimentation to investigate that possibility.

Entering Email in the Modal Window

Oddly (and conveniently) enough, if you use Git Credential Manager for Windows without credential.interactive = never in your gitconfig, you are actually able to authenticate with either your username or your email:

Screenshot of GCM Bitbucket modal authentication window accepting either username or email

If I enter my creds into this modal window, regardless of whether I use my username or my email address, the result is that the following is stored in Windows Credential Cache:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://bitbucket.org
    Type: Generic 
    User: my_bitbucket_username
    Local machine persistence

    Target: LegacyGeneric:target=git:https://my_bitbucket_username@bitbucket.org
    Type: Generic 
    User: my_bitbucket_username
    Local machine persistence

We can observe that both of the above stored credentials make reference to "my_bitbucket_username" and not "my@email.com". If I entered my email, how does my username end up in the credential cache? We can see how in the GCM logs:

11:52:56.381907 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
11:52:56.828859 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
11:52:56.829856 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
11:53:39.405970 ...icationPrompts.cs:96 trace: [CredentialModalPrompt] prompting user for credentials.
11:54:02.472771 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
11:54:02.898317 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
11:54:09.152400 ...\RestClient.cs:80    trace: [FindUsername] Found username [my_bitbucket_username]
11:54:14.257394 ...hAuthenticator.cs:31 trace: [GetAuthAsync] remote username [my_bitbucket_username] != [my@email.com] supplied username
11:54:14.280342 ...uthentication.cs:360 trace: [InteractiveLogon] token acquisition succeeded
11:54:37.472420 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username at https://bitbucket.org/
11:54:49.021027 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username at https://my_bitbucket_username@bitbucket.org/
11:55:30.418705 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username@bitbucket.org' written to store.
11:55:47.317635 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://bitbucket.org' written to store.

We can see here that, after prompting me for my credentials and receiving my email address and password, GCM talks to Bitbucket, which in turn responds with my username. This is what GCM ultimately stores with the 2 credentials in the credential cache.

With these 2 credentials in the cache, I can make subsequent clones without needing to re-input my credentials! This is true regardless of the setting of credential.interactive during those subsequent clones. It seems as though this is our desired state for the credential cache after authenticating.

Entering Email in the Text Prompt

Now what happens when I do use credential.interactive = never?

In this case, GCM doesn't talk to Bitbucket about my username. It simply takes the email I provided and uses it like a username:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my@email.com@bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

We can observe the notable lack of RestClient.cs in the logs:

11:37:28.737167 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
11:37:29.216370 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
11:37:29.217356 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
11:39:36.977570 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
11:40:06.719875 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.

11:40:06.745805 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
11:40:24.280739 run-command.c:626       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
11:40:29.676473 run-command.c:626       trace: run_command: 'C:/dev/myorganization/libraries/Git-Credential-Manager-for-Windows/Cli/Manager/bin/Debug/git-credential-manager.exe store'

11:40:35.515578 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
11:40:35.566473 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
11:40:35.571429 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
11:40:35.574421 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
11:40:35.575417 ...\Common.cs:312       trace: [EnableTraceLogging] GCM arguments:
protocol=https
host=bitbucket.org
path=
username=my@email.com
password=mypassword

11:40:35.599381 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my@email.com@bitbucket.org/'.
11:40:36.087947 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
11:40:36.087947 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my@email.com@bitbucket.org/'  is Bitbucket.
11:40:36.088944 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my@email.com@bitbucket.org/'.
11:43:19.647559 ...uthentication.cs:258 trace: [SetCredentials] my@email.com at https://my%40email.com@bitbucket.org/
11:44:32.428785 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my@email.com@bitbucket.org' written to store.

Also notably absent is the credential of the form, Target: LegacyGeneric:target=git:https://bitbucket.org. We can notice that there is only 1 call to SetCredentials in the above logs.

With only this credential in the cache, subsequent clones will prompt me again for my credentials every time.

Entering Username in the Text Prompt

If I enter my username rather than my email in the text prompt, the resulting log is essentially the same as the one in the previous section. However I end up with this nice, familiar credential in the credential cache:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my_bitbucket_username@bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence

Again, I end up with only 1 cached credential. This time, however, it looks just like one of the 2 I got when I used the modal window! Sadly, subsequent clones will still prompt me for my credentials every time. This entry in the credential cache is not, alone, sufficient.

Which Cached Credential is Actually Needed?

Further tinkering and testing revealed that if there is a single cached credential of either of the following 2 forms, subsequent clones will use it as expected:

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://bitbucket.org
    Type: Generic
    User: my@email.com
    Local machine persistence

or

$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence

If there is no such cached credential, I am prompted again for every clone.

Next Steps

So it seems the essence of the problem is:

If the above is true, a solution could perhaps be to change the behavior in the second bullet so that the necessary credential is saved in all cases. If time permits I would like to more closely investigate GetCredentials() and SetCredentials(), capture this bug in a unit test, and find some reasonable fix.

whoisj commented 6 years ago

@mminns @Foda this is some amazing debugging detective work on behalf of @mesbahamin for you. πŸ€©πŸ”Ž

mminns commented 6 years ago

@mesbahamin thanks. I'll take some time to read it in more detail.

I will just mention that the Bitbucket code should store credentials under git:https://username@bitbucket.org when the username is included in the repository's remote url. If the remote url does not include the username then the credentials should be stored as git:https://bitbucket.org.

Whether that is happening consistently/correctly is something for us to look in to.

mesbahamin commented 6 years ago

Verifying Our Expectations

Whether that is happening consistently/correctly is something for us to look in to.

@mminns I tested whether GCM's behavior conforms to our expectations. These 2 tests were done with GCM checked out at tag v1.17.1-preview.1 (commit 91d2120c0684694c382b737e3b4f9bb23d5ed0ef), and with this in the gitconfig:

[credential]
    interactive = never

Expectation 01

the Bitbucket code should store credentials under git:https://username@bitbucket.org when the username is included in the repository's remote url.

This appears to be happening as we expect. See the log for Test 01 at the end of this comment.

Expectation 02

If the remote url does not include the username then the credentials should be stored as git:https://bitbucket.org.

This does not happen as expected. See the log for Test 02 at the end of this comment. The resulting cached credential is identical to the one in Test 01.

Analysis

In both cases, by the time we get to SetCredentials(), targetUri contains "my_bitbucket_username". The if condition here evaluates to false, and SetCredentials() doesn't recurse, and only one credential, the one in the logs at the end of this comment, is cached:

/// <inheritdoc/>
public async Task<bool> SetCredentials(TargetUri targetUri, Credential credentials, string username)
{
    if (targetUri is null)
        throw new ArgumentNullException(nameof(targetUri));
    if (credentials is null)
        throw new ArgumentNullException(nameof(credentials));

    Trace.WriteLine($"{credentials.Username} at {targetUri.QueryUri.AbsoluteUri}");

    // If the Url doesn't contain a username then save with an explicit username.
    if (!targetUri.ContainsUserInfo && (!string.IsNullOrWhiteSpace(username)
        || !string.IsNullOrWhiteSpace(credentials.Username)))
    {

        var realUsername = GetRealUsername(credentials, username);
        Credential tempCredentials = new Credential(realUsername, credentials.Password);

        if (tempCredentials.Username.Length > BaseSecureStore.UsernameMaxLength)
            throw new ArgumentOutOfRangeException(nameof(tempCredentials.Username));
        if (tempCredentials.Password.Length > BaseSecureStore.PasswordMaxLength)
            throw new ArgumentOutOfRangeException(nameof(tempCredentials.Password));

        await SetCredentials(targetUri.GetPerUserTargetUri(realUsername), tempCredentials, null);
    }

    return await PersonalAccessTokenStore.WriteCredentials(targetUri, credentials);
}

Contrast this to our happy path, examined in some detail in my previous comment (see heading "Entering Email in the Modal Window"), in which I use the modal window to enter my credentials. In that case, by the time SetCredentials() is first called from InteractiveLogon():

Logs

Test 01 (Username In URL)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
$ git clone https://my_bitbucket_username@bitbucket.org/myorganization/myrepo.git
Cloning into 'myrepo'...
13:59:01.277874 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
13:59:01.329735 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
13:59:01.334723 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
13:59:01.338712 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
13:59:01.340711 ...\Common.cs:312       trace: [EnableTraceLogging] GCM arguments:
protocol=https
host=bitbucket.org
path=

13:59:01.375614 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username@bitbucket.org/'.
13:59:01.870290 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
13:59:01.870290 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username@bitbucket.org/'  is Bitbucket.
13:59:01.875278 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://my_bitbucket_username@bitbucket.org/'.
13:59:01.877272 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
Logon failed, use ctrl+c to cancel basic credential prompt.
Password for 'https://my_bitbucket_username@bitbucket.org':
13:59:28.263651 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
13:59:28.330778 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
13:59:28.336736 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
13:59:28.339728 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
13:59:28.341749 ...\Common.cs:312       trace: [EnableTraceLogging] GCM arguments:
protocol=https
host=bitbucket.org
path=
username=my_bitbucket_username
password=mypassword

13:59:28.363690 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username@bitbucket.org/'.
13:59:28.765037 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
13:59:28.766040 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username@bitbucket.org/'  is Bitbucket.
13:59:28.766040 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username@bitbucket.org/'.
13:59:39.966057 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username at https://my_bitbucket_username@bitbucket.org/
14:16:11.711244 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username@bitbucket.org' written to store.
remote: Counting objects: 29, done.
remote: Total 29 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (29/29), done.
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my_bitbucket_username@bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence

Test 02 (Username Not In URL)

$ cmdkey.exe /list

Currently stored credentials:

* NONE *
$Ξ»git clone https://bitbucket.org/myorganization/myrepo.git
Cloning into 'myrepo'...
14:26:07.458314 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'get'
14:26:07.512149 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:26:07.519130 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:26:07.522122 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:26:07.523120 ...\Common.cs:312       trace: [EnableTraceLogging] GCM arguments:
protocol=https
host=bitbucket.org
path=

14:26:07.558026 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://bitbucket.org/'.
14:26:08.019082 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:26:08.020053 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://bitbucket.org/'  is Bitbucket.
14:26:08.026037 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://bitbucket.org/'.
14:26:08.027033 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://bitbucket.org': my_bitbucket_username
Password for 'https://my_bitbucket_username@bitbucket.org':
14:26:41.040692 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.1) 'store'
14:26:41.114494 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
14:26:41.120478 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 50 entries.
14:26:41.122473 ...\Common.cs:446       trace: [LoadOperationArguments] interactive = 'never'.
14:26:41.124468 ...\Common.cs:312       trace: [EnableTraceLogging] GCM arguments:
protocol=https
host=bitbucket.org
path=
username=my_bitbucket_username
password=mypassword

14:26:41.148426 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://my_bitbucket_username@bitbucket.org/'.
14:26:41.551832 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
14:26:41.552808 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://my_bitbucket_username@bitbucket.org/'  is Bitbucket.
14:26:41.552808 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https://my_bitbucket_username@bitbucket.org/'.
14:26:46.107459 ...uthentication.cs:258 trace: [SetCredentials] my_bitbucket_username at https://my_bitbucket_username@bitbucket.org/
14:27:15.300154 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://my_bitbucket_username@bitbucket.org' written to store.
remote: Counting objects: 29, done.
remote: Total 29 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (29/29), done.
$ cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://my_bitbucket_username@bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence
mesbahamin commented 6 years ago

In both cases, by the time we get to SetCredentials(), targetUri contains "my_bitbucket_username".

A natural question to ask is:

"Why is initial value of the targetUri parameter of SetCredentials() "https://my_bitbucket_username@bitbucket.org/" when I enter my creds in the textual prompt, but "https://bitbucket.org/" when I enter the exact same creds in the modal window prompt?"

Some digging revealed that the username is injected into the URI here:

            // Username.
            if (!string.IsNullOrWhiteSpace(_username))
            {
                var username = NeedsToBeEscaped(_username)
                    ? Uri.EscapeDataString(_username)
                    : _username;

                buffer.Append(username)
                      .Append('@');
            }

This particular line of this method (OperationArguments.CreateTargetUri(), called by OperationArguments.ReadInput(), called by Program.Store()) is run after I input my credentials in the text prompt, and is not run at all when the modal window prompt is used.

Since this code is in a common part of the code base, and particularly since GitHub authentication doesn't seem to have any problem with it (see Test 3 of this previous comment), I suspect this code is doing what is intended, and that the problem does indeed lie in the behavior of either or both of SetCredentials() and GetCredentials() in Atlassian.Bitbucket.Authentication.Authentication.

mminns commented 6 years ago

I'm intending to look into this next week.

mminns commented 6 years ago

Hi, so no fixes yet but I've been doing some research to confirm my understanding.

Briefly, these are my results:

Authentication Credential.Interactive Url Authentication Prompts when cloning twice WCM credentials
2fa interactive https://user@bitbucket.org/... 1 2: git:https://user@bitbucket.org access_token + refresh_token
2fa interactive https://bitbucket.org/... 1 4: git:https://user@bitbucket.org access_token + refresh_token, git:https://bitbucket.org access_token + refresh_token
Basic interactive https://user@bitbucket.org/... 1 1: git:https://user@bitbucket.org password
Basic interactive https://bitbucket.org/... 1 2: git:https://user@bitbucket.org password, git:https://bitbucket.org password
Basic never https://user@bitbucket.org/... 1 1: git:https://user@bitbucket.org password
*** Basic never https://bitbucket.org/... 2 1: git:https://user@bitbucket.org password

All the behaviours worked as expected except the last one in the list, it prompted for credentials everytime you clone, I believe because it has not created the per host git:https://bitbucket.org entry in WCM so the GCM can't find the credentials when it next looks for it.

I want to double check behaviour using www.bitbucket.org but I think that is the one inconsistency/error.

Which seems to tally with the more in-depth research provided in all the comments above.

mminns commented 6 years ago

OK, a bit more research, a surprise or 2 for me.

I had assumed, incorrectly, that when the GUI is off , i.e. interactive=never, the command line username/password prompt would come from GCMW, but it doesn't it is Git itself doing the prompt.

Hence the GCMW GET fails -> GCMW GET fails -> Git command line prompt -> GCMW Store process seen in the logs when using interactive=never for Bitbucket urls.

The problem comes because the GCMW Store call from Git is passing in a user specific URL e.g. https://user@bitbucket.org/. It does this regardless of the original remote URL, https://bitbucket.org or https://user@bitbucket.org/, it picks up the username from the username/password prompt it runs.

So when using with interactive=never with a clean Windows Credential Manager:

A call like git clone https://bitbucket.org/blah/blah.git results in a call to the GCMW using:

protocol=https host=bitbucket.org path= interactive=Never

The GCMW will construct the following URL, https://bitbucket.org and look for credentials using that key. It can't find them and can't show a login prompt, GUI or otherwise, so instead it shows:

Logon failed, use ctrl+c to cancel basic credential prompt.

Git appears to trigger this twice.

Since the GCMW did not return any credentials, Git will then prompt with:

Username for 'https://bitbucket.org/': username Password for 'https://username@bitbucket.org/':

Assuming you provide good credentials, Git then calls the GCMW with:

protocol=https host=bitbucket.org path= username=testoneitofinity password=password interactive=Never

The GCMW then creates the URL https://username@bitbucket.org and stores the credentials against it.

In principle for GitHub and VSTS this doesn't matter because GCMW will strip away the username and store credentials against https://github.com or https://mminns.visualstudio.com etc.

For Bitbucket, because we support per-user credentials, they get stored against https://user@bitbucket.org/.

The problem then arises because the next time a pull/push etc command is run against https://bitbucket.org/blah/blah.git Git again calls GCMW GET with the following parameters:

protocol=https host=bitbucket.org path= interactive=Never

The GCMW will again construct the following URL, https://bitbucket.org and look for credentials using that key, but the only credentials we have stored are for https://user@bitbucket.org so the whole process starts again.

Apologies if this was duplicating information in earlier posts

Conclusions

This problem only occurs when the interactive=never and a repository URL that does not include a username.

The problem arises because the STORE method essentially just trusts the information passed to it by Git because each call to GCMW is atomic and we have no concept of what might have happened before it has to. In interactive=never mode STORE is called with the same parameters by Git, regardless of whether the repository remote URL includes a username or not.

The problem does not arise when interactive!=never because storing credentials in WCM is all handled atomically during the GET call. GCMW and the Bitbucket code has the full context and can store credentials as per user and/or simple host based URLs.

Fixes?

  1. Workaround: Use repository remote URLs that include usernames for Bitbucket.
  2. Always overwrite the host, https://bitbucket.org, credentials when GCMW STORE is called for Bitbucket.
  3. Alter the GCMW behaviour to manage a full command line prompt during a GET call using intreractive=never rather than falling back to Git itself for Bitbucket (for All hosts?).

I think the 3rd option above is the equivalent of modalprompt=false ?

Oddities

cc: @whoisj I've not yet tested all these behaviours with GitHub, I need to turn 2fa off on my account first, but I have tested this with VSTS and it doesn't seem to work either. Essentially using a username/password (not a PAT) and interactive=never GCMWwill not save credentials during the STORE call, that doesn't feel right?

mminns commented 6 years ago

Actually using the following configuration for Bitbucket URLs without usernames seems to work as expected:

git config --global credential.modalPrompt false git config --global --unset credential.interactive

so that GCMW is called with:

modalPrompt=false interactive=Auto

This makes GCMW handle the username/password command line input as part of the GET.

Which makes me wonder if the interactive=never and modalPrompt=false should be doing the same thing?

whoisj commented 6 years ago

@mminns re: VSTS handling of Git's GET and STORE calls - the VSTS authentication handlers ignore the STORE calls because of the difficulties with 1:1 mapping; I do not remember what the GitHub variant does.

Re: interactive=never and modalPrompt=false cases, the same authentication and authority types should used, just the interface presented (or not presented in this case) should differ. In the case of VSTS, we have no way to authenticate without the modal dialog, so we just fail. In the case of GitHub they used the console flow I authored like 2 years ago. In fact, I Bitbucket may use the same interface functions.

Which makes me wonder if the interactive=never and modalPrompt=false should be doing the same thing?

I agree, they should be.

mminns commented 6 years ago

Re: interactive=never and modalPrompt=false cases, the same authentication and authority types should used

That is what I am seeing and what I'd expect.

So ultimately I think the actual change coming out of this discussion will be to update Bitbucket flow so interactive=never has the same outcome as modalPrompt=false i.e. to run a non-modal console flow for GET calls.

I will make a start and put a PR when its ready.

mminns commented 6 years ago

@whoisj Once again I'm probably missing something obvious, but can you assign this to me?

Thanks

whoisj commented 6 years ago

@whoisj Once again I'm probably missing something obvious, but can you assign this to me?

Apparently, I cannot. πŸ˜– image

mminns commented 6 years ago

I'm actually having second thoughts about making interactive=never and modalPrompt=false do the same thing.

Logically interactive=never seems to imply never ever show a prompt where as modalPrompt=false implies if you are going to prompt the user then do it via the command line.

Personally I have no use case for interactive=never but I wouldn't be surprised if there is one out there somewhere. I'm not sure it is the right thing to do to effectively just remove it.

That being the case @mesbahamin does setting interactive=never (actually the default anyway) and modalPrompt=false solve your problem?

It should give a command line only prompt for credentials when they don't exist, but when entered they will be correctly stored for the next call, so the user/CI is only ever prompted once.

whoisj commented 6 years ago

Personally I have no use case for interactive=never but I wouldn't be surprised if there is one out there somewhere. I'm not sure it is the right thing to do to effectively just remove it.

One word: automation. 😁 No, seriously that is what it is for. If a user is in a setup where an interactive prompt would effectively create a deadlock scenario (because there's no human to answer it), they should be using credential.interactive=never.

interactive=never (actually the default anyway)

The default should be Auto, if it is not then we have a bug.

mminns commented 6 years ago

The default should be Auto, if it is not then we have a bug

Sorry you are 100% correct. πŸ‘

But I think my, re-phrased and corrected, question still stands:

That being the case @mesbahamin does setting interactive=Auto and modalPrompt=false solve your problem?

If so then I don't think there is anything to do here.

mesbahamin commented 6 years ago

@mminns I will test today and report back.

PaulDotNet commented 6 years ago

Maybe this info can help somebody. I had annoying problem using Git with Atlassian SourceTree. I had to re-enter bitbucket credentials again and again. Then I replaced default installation of Git Credentials Manager with compiled debug version and encountered timeouts every time cred manager tried to validate credentials from UI. Here is the rough stack trace of situation:

Network.HttpGetAsync()  //  this one timed out
Atlassian.Bitbucket.Authentication.Rest.TryGetUser()
Atlassian.Bitbucket.Authentication.Authority.ValidateCredentials() // this was called twice - thus 2 dialogs
Microsoft.Alm.Cli.CommonFunctions.QueryCredentials()

Tried changing default timeout value from 15 seconds to 30 - no luck.

mesbahamin commented 6 years ago

@mminns, interactive = Auto and modalPrompt = false works as desired. I am prompted once, and then never again. After that initial prompt, I have these credentials:

C:\dev
Ξ» cmdkey.exe /list

Currently stored credentials:

    Target: LegacyGeneric:target=git:https://bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence

    Target: LegacyGeneric:target=git:https://my_bitbucket_username@bitbucket.org
    Type: Generic
    User: my_bitbucket_username
    Local machine persistence

@whoisj said:

If a user is in a setup where an interactive prompt would effectively create a deadlock scenario (because there's no human to answer it), they should be using credential.interactive=never.

Indeed, the original reason I was using interactive = never was because build agents were silently deadlocking with a prompt for credentials. I read the documentation for this project, which recommended use of interactive = never in such a scenario.

So I'm still wondering what I should be doing in this situation. It seems to me that either the behavior of GCM needs to change or the documentation needs to change. I'm not clear which.

mminns commented 6 years ago

From a personal point of view I don't think the documentation is explicitly wrong, it just needs expanding to explain some more of the nuances.

mesbahamin commented 6 years ago

Yes I agree. Perhaps it could say something about needing to get the necessary credentials stored in Windows credential cache before turning on interactive = never. Does that seem reasonable? If so, maybe I can submit a PR.

And can we safely conclude that GCM is behaving as it should? I'm still not certain about that, so I would like to hear your thoughts. Are there any lingering questions or uncertainties?

I didn't look into what @PaulDotNet brought up. Is that connected to this?

mminns commented 6 years ago

I don't think @PaulDotNet 's issue is directly related. Perhaps you could raise a separate issue Paul?

I think the GCM is behaving as intended, i.e.

I agree it a bit ambiguous but I'd personally be loathe to change any of the existing behaviours until there was a compelling use case showing they were wrong.

whoisj commented 6 years ago

Indeed, the original reason I was using interactive = never was because build agents were silently deadlocking with a prompt for credentials. I read the documentation for this project, which recommended use of interactive = never in such a scenario.

I highly recommend not relying on a credential manager for automation situations. Instead, I recommend using SSH or HTTPS with the -c "http.extraHeader=Authorization: BASIC {base64encoded("{username}:{passwrord}")}"