























📦 由AI生成的摘要
在尝试使用 `git push -u origin main` 时,出现了权限错误,提示旧用户被拒绝访问。为了解决这个问题,作者尝试通过 `git commit --amend --reset-author` 重置提交作者,但问题依旧。最终在 Stack Overflow 找到解决方案:删除旧的凭证,成功解决了问题,节省了一个小时的时间。
在最开始尝试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个小时。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。