Returning to a project that had lain fallow for several months, I found I was unable to push changes from my work in progress branch up to GitHub.

When I tried to push my branch, I got the following error:

C:\GitHub\wordtutor\
[feature/update-packages-dotnet6 +2 ~0 -0 !]
11:36:24 PS> git push --set-upstream origin feature/update-packages-dotnet6
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/theunrepentantgeek/wordtutor.git/'

After reading the linked page I was somewhat confused as I already had the Git Credential Manager installed; manually setting up a personal access token (PAT) shouldn’t be necessary.

Instead of just failing authentication, I expected the Git Credential Manager to automatically reprompt for my credentials, including 2FA as required. This wasn’t happening.

Upgrading the Git Credential Manager to the latest version by updating Git For Windows to the latest version didn’t make any difference.

After following a number of dead-end leads, I ended up looking at my global .gitconfig file, found in my home directory (in my case, C:\users\Bevan).

Under the [credential] section, there was a duplicate helper setting … with a blank value …

[credential]
    helper =
    helper = C:/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe

That blank value looked dodgy … so after backing up my .gitconfig file, I removed the extra:

[credential]
    helper =
    helper = C:/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe

Then, I retried my push …

C:\GitHub\wordtutor\
[feature/update-packages-dotnet6 +2 ~0 -0 !]
11:36:36 PS> git push --set-upstream origin feature/update-packages-dotnet6
info: please complete authentication in your browser...
Everything up-to-date
Branch 'feature/update-packages-dotnet6' set up to track remote branch 'feature/update-packages-dotnet6' from 'origin'.

Success!

So if you are failing to authenticate automatically with GitHub (or any upstream repo host), you’re running on Windows, and the Git Credential Manager isn’t automatically prompting you for updated credentials, check your .gitconfig file.

Comments

blog comments powered by Disqus