如何在Git Bash上更改用户? [英] How can I change the user on Git Bash?

查看:1043
本文介绍了如何在Git Bash上更改用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想注销一个实际用户,以便可以与另一个用户登录.

I want to sign out an actual user so I can sign in with another user.

我在Git bash中看到的是:

What I see in Git bash is:

MINGW64 ~/Documents/NetBeansProjects/ConstructorJava (master)
git push -u origin/master
remote: Permission to Fre1234/ConstructorJava.git denied to Fre123.  
Fatal: unable to access https://github.com/Fre1234/ConstructorJava.git/": The requested URL returned error: 403

推荐答案

检查git remote -v返回的内容:用于推送到http url的帐户通常嵌入到远程url本身.

Check what git remote -v returns: the account used to push to an http url is usually embedded into the remote url itself.

https://Fre123@github.com/...

如果是这种情况,请输入一个网址,该网址将迫使Git在推送时要求使用该帐户:

If that is the case, put an url which will force Git to ask for the account to use when pushing:

git remote set-url origin https://github.com/<user>/<repo>

或者使用Fre1234帐户:

Or one to use the Fre1234 account:

git remote set-url origin https://Fre1234@github.com/<user>/<repo>

还要检查是否安装了具有或没有凭据的 Git For Windows 助手在此问题中.

Also check if you installed your Git For Windows with or without a credential helper as in this question.

OP Fre1234 添加了

我终于找到了解决方法.
转到:Control Panel -> User Accounts -> Manage your credentials -> Windows Credentials

I finally found the solution.
Go to: Control Panel -> User Accounts -> Manage your credentials -> Windows Credentials

Generic Credentials下,有一些与Github相关的凭据,
单击它们,然后单击"Remove".

Under Generic Credentials there are some credentials related to Github,
Click on them and click "Remove".

这是因为适用于Windows的Git的默认安装设置了 Git-Credential-Manager-for-Windows .
请参见git config --global credential.helper输出(应为manager)

That is because the default installation for Git for Windows set a Git-Credential-Manager-for-Windows.
See git config --global credential.helper output (it should be manager)

这篇关于如何在Git Bash上更改用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆