'github git-credential: "erase" operation not supported

I have some trouble with the github repository I am working on. I just realised I am 3 commits ahead of main and wanted to push, but the terminal prompted the following:

git push
gh auth git-credential: "erase" operation not supported
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/name/project/'

Has anyone encountered this before and can help?

Many thanks



Solution 1:[1]

You need to re-authenticate with GitHub. Run the following command and follow the prompts.

gh auth login

Solution 2:[2]

The accepted answer didn't work for me.

I had to do gh auth refresh instead.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stephen Briney
Solution 2 tet