gpt4 book ai didi

git - 无法更改 Git 帐户

转载 作者:IT王子 更新时间:2023-10-29 00:56:54 25 4
gpt4 key购买 nike

我尝试推送到我的存储库,但出现以下错误:

git push origin master
remote: Permission to PhanVanLinh/phanvanlinh.github.io.git denied to edgarphan.
fatal: unable to access 'https://github.com/PhanVanLinh/phanvanlinh.github.io.git/': The requested URL returned error: 403

之前,我使用的用户名是edgarphan,但我已经将其更改为PhanVanLinh,但它仍然保留edgarphan

我尝试过删除项目并重新克隆,卸载Git并重新安装,但都不行。

Enter image description here

全局配置文件

Enter image description here

我该如何解决这个问题?

最佳答案

这与你的user.name无关/user.email设置:那些用于提交中的作者身份。当您推送到存储库时,它们用于身份验证。

如果 Git 询问您的 GitHub(新)用户名/密码,这意味着 Git for Windows正在使用名为“manager”的 Git 凭证助手(执行 git config credential.helper 以确认)

含义:它正在缓存您的旧凭据并自动重新使用它们。

在这种情况下,转到 Windows 开始菜单 (Windows start),键入“凭据”并选择 Windows 工具“Windows Credential Manager”。
enter image description here
在其中,您会找到一个条目 git.https://github.com ,您可以对其进行编辑,并且可以在其中输入新的 GitHub 用户名/密码。 Enter new credentials

然后再次尝试推送。


使用更新的 Git 版本(2.32+,2021 年第 2 季度),假设 <C:\path\to\git>\usr\bin<C:\path\to\git>\mingw64\libexec\git-core在你的%PATH% ,您可以在命令行中执行相同的删除操作:

printf "protocol=https\nhost=github.com\nusername=xxx"| git-credential-manager-core erase

关于git - 无法更改 Git 帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46629838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com