You would need a bash script (that can work, even on Windows, through a Git for Windows bash), in order to:
- detect your OS
- detect the credential helper (if any) set: git config credential.helper
- remove the credentials associated to a given URL passed as parameter of that script;
For instance, see "sign out in the Git Bash console in Windows":
git credential-manager reject https://github.com
On Mac, for osxkeychain
, see "Updating credentials from the OSX Keychain"
git credential-osxkeychain erase https://github.com
The point is: you need a script to automate that step for all possible credential caching mechanism.
Then try again: it will prompt for user GitHub username/password.
See also git credential reject
from Git 2.42 (Q3 2023)