所以我有一个旧的GitHub帐户,我不再使用了,但我仍然使用相同的笔记本电脑,所有旧的配置文件指向我的旧git用户仍然那里。推送到远程URL时使用错误的用户Git
所以我去~/.gitconfig
和改变
[user]
name = my_new_user
email = [email protected]
然而,每当我在一个项目的回购协议是,我试图把我得到这个错误
ERROR: Permission to my_new_user/gitrepo.git denied to my_old_user.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
所以我试着去到我的项目中的本地配置文件中。改变从http://github/my_new_user/gitrepo.git
远程URL来
url = [email protected]:my_new_user/gitrepo.git
但我仍然得到同样的错误。
我觉得自己很愚蠢,错过了一些东西,但是因为我已经阅读过的东西提示改变了远程原始网址,所以我的工作似乎不起作用。
你有一个'pushurl'设置远程Git网址的文章? 'user.name'设置仅影响提交的作者权限,而不影响存储库的访问权限。 – gauteh
@gauteh啊我看到没有我没有'pushurl'集。不过,我有一个'fetchurl'。我假设的是我的问题 – PourMeSomeCode
如果'pushurl'和'fetchurl'是相等且唯一的,则只能使用'url'。 – gauteh