git-ecosystem / git-ecosystem/git-credential-manager

GCM OAuth Issue - GCM Erases Expired Token But Does Not Renew - Gitea

Open
#1,408 29 comments 15 reactions 1 assignee View on GitHub

@mjcheetham is already working on this.

Since Oct 30, 2023.

auth-issue auth:oauth bug
Dominant language
C#
Stars
9.3k
Forks
2.9k
Avg merge
7d 1h
Merged PRs (30d)
14

Description

Version

2.3.2

Operating system

Windows

OS version or distribution

Windows 11 Enterprise 22H2

Git hosting provider(s)

Other - please describe below

Other hosting provider

Self-hosted Gitea

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

None

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

When I run git push after committing my changes I'd expect the behavior to be as folows:

PS C:\Users\myusername\sysadmin-scripts> git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 906 bytes | 906.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To https://mygiteaserver.internaldomain.com:3000/myOrg/sysadmin-scripts.git
   b3d7adc..5a1518c  main -> main
Actual behavior

When running git push after a certain amount of time (I want to say 1-2 hours) I get the following error

remote: Verify
fatal: Authentication failed for 'https://mygiteaserver.internaldomain.com:3000/myOrg/sysadmin-scripts.git/'

The only way I can get around this is removing all these entries from Windows Credential Manager. The current authentication in the internal Gitea server is using Azure AD for whatever that might be worth.

image

Logs
11:36:03.353003 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.3.2.0
11:36:03.353003 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
11:36:03.353003 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
11:36:03.353003 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 22621)
11:36:03.353003 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
11:36:03.353003 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
11:36:03.353003 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: get
11:36:03.390958 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'get' command...
11:36:03.398351 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
11:36:03.400369 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	protocol=https
11:36:03.400369 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	host=mygiteaserver.internaldomain.com:3000
11:36:03.400369 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	wwwauth=Basic realm="."
11:36:03.402886 ...oviderRegistry.cs:99 trace: [GetProviderAsync] Host provider override was set id='generic'
11:36:03.404917 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Generic' was selected.
11:36:03.406921 ...\HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://mygiteaserver.internaldomain.com:3000 account=...
11:36:03.412228 ...\HostProvider.cs:140 trace: [GetCredentialAsync] Existing credential found.
11:36:03.412228 ...\GetCommand.cs:39    trace: [ExecuteInternalAsync] Writing credentials to output:
11:36:03.412228 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync] 	protocol=https
11:36:03.412228 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync] 	host=mygiteaserver.internaldomain.com:3000
11:36:03.412228 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync] 	username=OAUTH_USER
11:36:03.412228 ...\GetCommand.cs:40    trace: [ExecuteInternalAsync] 	password=********
11:36:03.413233 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'get' command...
11:36:03.797506 ...\Application.cs:106  trace: [RunInternalAsync] Version: 2.3.2.0
11:36:03.797506 ...\Application.cs:107  trace: [RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
11:36:03.797506 ...\Application.cs:108  trace: [RunInternalAsync] Platform: Windows (x86-64)
11:36:03.797506 ...\Application.cs:109  trace: [RunInternalAsync] OSVersion: 10.0 (build 22621)
11:36:03.797506 ...\Application.cs:110  trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager.exe
11:36:03.797506 ...\Application.cs:111  trace: [RunInternalAsync] InstallDir: C:\Program Files\Git\mingw64\bin\
11:36:03.797506 ...\Application.cs:112  trace: [RunInternalAsync] Arguments: erase
11:36:03.832110 ...GitCommandBase.cs:32 trace: [ExecuteAsync] Start 'erase' command...
11:36:03.839165 ...GitCommandBase.cs:46 trace: [ExecuteAsync] Detecting host provider for input:
11:36:03.840168 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	protocol=https
11:36:03.840168 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	host=mygiteaserver.internaldomain.com:3000
11:36:03.840168 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	username=OAUTH_USER
11:36:03.840168 ...GitCommandBase.cs:47 trace: [ExecuteAsync] 	password=********
11:36:03.843636 ...oviderRegistry.cs:99 trace: [GetProviderAsync] Host provider override was set id='generic'
11:36:03.845657 ...GitCommandBase.cs:49 trace: [ExecuteAsync] Host provider 'Generic' was selected.
11:36:03.845657 ...\HostProvider.cs:173 trace: [EraseCredentialAsync] Erasing stored credential in store with service=https://mygiteaserver.internaldomain.com:3000 account=OAUTH_USER...
11:36:03.851760 ...\HostProvider.cs:176 trace: [EraseCredentialAsync] Credential was successfully erased.
11:36:03.851760 ...GitCommandBase.cs:53 trace: [ExecuteAsync] End 'erase' command...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.