If anyone is still struggling in 2024 or later, plz refer to this Link. Basically remove the credentials from keychain using commandline:
git credential-osxkeychain erase host=github.com protocol=https