I changed my Github account recently. I have my new username and email stored in global .gitconfig:
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[user]
name = myusername
email = [email protected]
[credential]
helper = store
username = myusername
and my password for github in .git-credentials.
Every time I push to my remote repository Github login pops up asking me for my credentials.
And when I cancel it everything works fine. I don't need to enter username or password. Remote is updated. How to get rid of that popup? I didn't have that behaviour before changing account credentials.
Git has the concept of multiple credential managers. When you installed Git for Windows, it came with the Git Credential Manager for Windows (either the old one or Core), and you probably answered a question about whether you wanted to use it or not.
Somewhere in an earlier config file, such as the system one, there's a setting that looks like credential.helper = manager
. Because Git invokes the credential managers in order and uses the first one that provides it credentials, it first asks the manager
one specified at the system level, causing the pop-up, and then invokes the store
one in your local config file.
What likely happened is that your old account was using the manager
helper but the new one is using the store
helper for saving your password, so the prompt didn't show up for manager
because it had your credentials saved.
If you don't find the manager
helper, run git config -l --show-origin
to find the file which has the other credential.helper
setting and then edit it to remove that option.
Do note that the manager
helper is going to be more secure than storing your credentials in a file on disk (since it will be encrypted), and it will use a personal access token, which GitHub will require in the future, so you may want to use the popup prompt to get credentials and remove the store
helper instead.