首页 > 解决方案 > 两个github账号在同一台电脑上冲突

问题描述

我有 2 个 github 帐户,一个用于个人使用,一个用于工作。

我在一个个人网站上工作,所以我使用我的个人用户名和密码从终端登录了 git。当我执行“git config --list”时,我会看到我个人帐户的正确用户名和密码,正如我所期望的那样。

但是,当我尝试将我的代码推送到我的个人帐户时,它会出现此错误...

remote: Permission to <personal_username>/<personal_repo>.git denied to <work_username>.

我什至不知道它从哪里获取我的工作用户名或工作凭据,因为它们没有在我的 git 配置中列出。

请帮忙!

谢谢

标签: gitgithubsshhttpsversion-control

解决方案


如果 URL 是 HTTPS 的,请检查您的git config credential.helper: if manager, if would have cached, you need to reject its URL

git credential-manager reject 
protocol=https
host=github.com

推荐阅读