windows 如何让 Git 每次推送时都要求输入用户名和密码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25735957/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I make Git ask for a username and password every time I push?
提问by Joshua Johnson
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.
在我工作的地方,很多人使用同一个帐户使用同一台计算机。我们现在使用 shell 而不是 GUI 只是为了方便。
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:
第一次有人提交时会询问他们的用户名和密码,但之后就使用他们的帐户进行所有提交。很抱歉我对shell了解不多,但这是我第一次使用它。我用来提交和同步的命令是:
git commit -a
git push origin [branch name here]
采纳答案by u1860929
It seems that users credentials are being cached.
似乎正在缓存用户凭据。
Go to your project, open .git/config
and remove the lines:
转到您的项目,打开.git/config
并删除以下行:
[credential]
helper = store
# or helper=cache
Check git-credential-storefor more information.
检查git-credential-store以获取更多信息。
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.
编辑:OP 在评论中提到这发生在 Windows 中,为此,另一个答案与从控制面板中删除凭据更相关。