Github 推送时拒绝新ssh用户的权限

Github 推送时拒绝新ssh用户的权限,github,ssh-keys,Github,Ssh Keys,我正在使用终端,我想从和旧用户(旧用户名)中删除ssh密钥,并设置一个新的(新用户名)。我在这件事上做得很好 当我运行时:ssh-Tgit@github.com我得到了正确的信息: `Hi new_username! You've successfully authenticated'. 但当我尝试推送存储库时,我被拒绝: remote: Permission to new_username/test2.git denied to old_username. fatal: unable to

我正在使用终端,我想从和旧用户(旧用户名)中删除ssh密钥,并设置一个新的(新用户名)。我在这件事上做得很好

当我运行时:
ssh-Tgit@github.com
我得到了正确的信息:

`Hi new_username! You've successfully authenticated'.

但当我尝试推送存储库时,我被拒绝:

remote: Permission to new_username/test2.git denied to old_username.
fatal: unable to access 'https://github.com/new_username/test2/': The requested URL returned error: 403

我已尝试删除.ssh文件夹并再次设置ssh,但问题仍然存在。

如果在Linux或OSX上,请检查名为~/.netrc的文件,其中包含大多数应用程序在连接到远程服务器时将使用的用户名/密码信息。是的,它甚至通过https协议影响git。如果您使用前端连接到github,可能需要清除其首选项,以便它停止尝试使用旧用户名。

使用https url意味着您的ssh连接未被使用。一点也不

尝试切换到ssh:

git clone git@github.com:new_username/test2
这将实际使用您的ssh凭据,即存储在
~/.shh/id\u rsa(.pub)
中的公钥和私钥