remote:推送到github时权限被拒绝

时间:2020-08-04 05:33:33

标签: git github

我有两个使用用户名samwelnm2022和mchomvus4的github帐户,我有一项工作要推送到用户名mchomvus4,但是当我尝试从git推送时,我收到一条错误消息

remote: Permission to myRepositoryname.git denied to samwelnm2022.
fatal: unable to access 'https://github.com/myRepositoryname.git/': The requested URL 

returned error: 403

我试图通过GitHub Desktop进行工作,并且工作正常

任何可以帮助我的人

1 个答案:

答案 0 :(得分:0)

使用错误的用户名意味着凭据缓存(git config credential.helper)已缓存与github.com关联的samwelnm2022的凭据。

如果您需要使用其他帐户进行一次推送,请尝试:

git push https://mchomvus4@github.com/<me>/<myRepo> master

这将强制为该特定推送使用其他GitHub用户帐户。