hickford/git-credential-oauth

How to disable other credential helpers?

Closed this issue · 4 comments

joes commented

On Windows Server 2019 using:

PS git --version
PS git version 2.39.2.windows.1

with this .gitconfig :

[credential]
	helper = "D:/git-credential-oauth/git-credential-oauth.exe -device" 
[credential "https://gitlab.example.com"]
	oauthClientId = redacted
	oauthScopes = read_repository write_repository
	oauthAuthURL = /oauth/authorize
	oauthTokenURL = /oauth/token
	oauthDeviceAuthURL = /oauth/authorize_device

I was expecting not to see any dialogue popping up but I am seeing this:

image

I then need to close the dialogue without signing in and then I can see the device code flow prompt:

image

I am able to open the url and enter the code and it works as expected from thereon.

Is the dialogue expected to show if -device is set?

Your first screenshot shows Git Credential Manager https://github.com/git-ecosystem/git-credential-manager

Run git config --get-all credential.helper to see which helpers you have configured.

Then try:

[credential]
	helper =
	helper = "D:/git-credential-oauth/git-credential-oauth.exe -device" 
[credential "https://gitlab.example.com"]
	oauthClientId = redacted
	oauthScopes = read_repository write_repository
	oauthAuthURL = /oauth/authorize
	oauthTokenURL = /oauth/token
	oauthDeviceAuthURL = /oauth/authorize_device

following https://git-scm.com/docs/gitcredentials#Documentation/gitcredentials.txt-helper

If credential.helper is configured to the empty string, this resets the helper list to empty

joes commented

That did the trick @hickford! Thanks for helping out.

joes commented

On git version 2.39.2.windows.1 it seems the credential-cache is disabled:

git credential-cache
fatal: credential-cache unavailable; no unix socket support

Thus adding cache --timeout 21600 as a helper won't work.

As an attempt at a workaround I added wincred as a helper and after that I do not reed to reauthorize again and again. Would this be a good workaround on Windows @hickford or does it has some side effects? I guess the token might not be refreshed as expected and I guess it is not technically cached then?

[credential]
        helper = 
	helper = wincred
	helper = "D:/git-credential-oauth/git-credential-oauth.exe -device" 
[credential "https://gitlab.example.com"]
	oauthClientId = [appId]
	oauthScopes = read_repository write_repository
	oauthAuthURL = /oauth/authorize
	oauthTokenURL = /oauth/token
	oauthDeviceAuthURL = /oauth/authorize_device
joes commented

Nevermind, I just updated "git for windows" ant it seems credential-cache is now supported on "git for windows" too. I just did not get the impression that this was fixed from the various issues floating around.