问题
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 synchronise are:
git commit -a
git push origin [branch name here]
回答1:
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.
回答2:
If you use a Windows system, the Git username and password is stored in a control panel. You can go to Control Panel → User Accounts → Credential Manager:Generic Credentials to delete it.
来源:https://stackoverflow.com/questions/25735957/how-do-i-make-git-ask-for-a-username-and-password-every-time-i-push