Search code examples
windowsgitgithubcredentials

How do I make Git ask for a username and password every time I push?


Where I work many people use the same computer on the same account. We now use the shell instead of the GUI just for convenience.

The first time someone committed it asked for their username and password, but after that just used their account for all commits. I'm sorry that I don't know much about the shell, but this is the first time I'm using it. The commands I use to commit and synchronize are:

git commit -a
git push origin [branch name here]

Solution

  • It seems that users credentials are being cached.

    Go to your project, open .git/config and remove the lines:

    [credential]
        helper = store
        # or helper=cache
    

    Check git-credential-store for more information.

    Edit: OP mentions in the comments that this is happening in Windows, for which, the other answer is more relevant for removing the credentials from the Control Panel.