在 Android Studio 中登录了错误的 Git 帐户 [英] Signed Into Wrong Git Account in Android Studio

查看:28
本文介绍了在 Android Studio 中登录了错误的 Git 帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在在 Android Studio 为一个团队工作,并且目前登录到另一个团队成员的 Github 帐户.我需要从 Intellij 推送到存储库,目前拥有它的成员登录并使用他的帐户比将我的帐户添加到存储库更容易.现在,我需要推送到我自己的存储库,但不能,因为我仍然(某处)登录了我队友的帐户.我曾尝试使用终端更改 user.name 和 user.email,但无济于事.他是第一个在这台计算机上登录的人,但我仍然收到 403 错误,我该怎么办?有没有办法让他退出?

I'm working for a team right now in Android Studio, and am currently signed into another team member's Github account. I needed to push to a repo from Intellij, and in the moment it was easier for the member who owned it to sign in and use his account, than to add mine to the repository. Now, I need to push to my own repo, and can't, because I'm still (somewhere) signed into my teammate's account. I have tried using the terminal to change user.name and user.email, to no avail. He was the first to ever sign in on this computer, and I'm still getting a 403 error so where do I go from here? Is there a way to sign him out?

供以后参考,@VonC 提供的有关删除帐户的链接解决了该问题.

For future reference, the link provided by @VonC about removing the account solved the issue.

推荐答案

参见为 Git 远程设置密码" 用于 IntelliJ IDEA(适用于 Android Studio)

See "Set passwords for Git remotes" for IntelliJ IDEA (which does apply for Android Studio)

如果您使用 HTTP 访问远程,当您执行需要身份验证的操作时,Git 会从凭证帮助程序请求凭证.如果未找到凭据帮助程序,则会向 IDE 返回提示.

If you are using HTTP to access a remote, Git requests credentials from a credential helper when you perform an operation that requires authentication. If no credential helper is found, it returns a prompt to the IDE.

检查 git config credential.helper 的值:如果你的远程 URL 是 HTTPS 的,凭据助手会缓存其他成员的凭据.

Check the value of git config credential.helper: if your remote URL is an HTTPS one, the credential helper would have cached the credentials of the other member.

您需要首先删除该凭据(如此处所示),Android Studio 才能提示您输入下一次推送的凭据.

You need to delete that credential first (as shown here), before Android Studio is able to prompt you for your credentials at the next push.

另请查看 IntelliJ IDEA 密码政策.

这篇关于在 Android Studio 中登录了错误的 Git 帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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