注销并以另一个用户身份登录 git bash
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23740734/
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
Logout and login as another user git bash
提问by Nisar
I want to logout from Git bash and login it again as another user .
我想从 Git bash 注销并以另一个用户身份再次登录。
I have googled but can't find any solution.
我用谷歌搜索但找不到任何解决方案。
采纳答案by VonC
You don't have to "logout" or "login": regarding git, who you are is determined by:
您不必“注销”或“登录”:关于 git,您是谁由以下因素决定:
git config user.name
git config user.email
Change those two settings while being in a repo, and you are someone else, when it comes to creating commits.
在 repo 中更改这两个设置,在创建提交时,您就是其他人。
That has nothing to do with git remote -v
, that is with the user account you will use to push to the upstream repo.
这git remote -v
与您将用于推送到上游存储库的用户帐户无关。
- for an https url, you can simply specify a new user
- for ssh, you would need a
~/.ssh/config
file referring to multiple private ssh keys(also described here).
- 对于 https url,您可以简单地指定一个新用户
- 对于 ssh,您需要一个
~/.ssh/config
引用多个私有 ssh 密钥的文件(也在这里描述)。
回答by Deepak swain
use
用
git config --global user.name [Your User name]
git config --global user.email [Your Email]
回答by Kartik Ranpise
For Windows User: Follow Instructions: Control Panel >> User Account >> Credential Manager >> Windows Credential >> Generic Credential You can change git credential click modify>>provide uname and password Or you can remove git credential. next time when you'll push repo it'll ask you for credential.
对于 Windows 用户:按照说明操作:控制面板 >> 用户帐户 >> 凭据管理器 >> Windows 凭据 >> 通用凭据您可以更改 git 凭据单击修改>>提供 uname 和密码 或者您可以删除 git 凭据。下次当您推送 repo 时,它会要求您提供凭据。