🌒MoonLab

> 在MoonLab中搜索

Git push 出现 permisson denied error 403

Category: Programming

🏷️  git   中文

在最开始尝试push:

$ git push -u origin main

结果出现:

remote: Permission to XXX/repo.git denied to Olduser.

fatal: unable to access 'https://github.com/xxx/repo.git/': The requested URL returned error: 403

因为我之前设置了local的username,但是这里却显示了旧用户被拒绝请求了,所以我以为是上一次的commit的author还是旧用户,导致验证不通过。

所以我再次尝试:

$ git commit --amend --reset-author

结果还是一样,最后在 stackoverflow 中找到了方法

把这个凭证删了就行,浪费我1个小时。

2018-2024 MoonLab