To fix this on macOS, you can use
git config --global credential.helper osxkeychain
With your next Git action (pull, clone, push, etc.), a username and password prompt will appear.
For Windows, there is a different argument with almost the same command:
git config --global credential.helper wincred