git push The requested URL returned error: 403 Forbidden while accessing

时间:2021-06-11 12:25:38

错误提示信息:

error: The requested URL returned error:  Forbidden while accessing https://github.com/xingfupeng/test.git/info/refs
fatal: HTTP request failed

解决方案:

修改.git/config文件,将下面的代码:

[remote "origin"]
url = https://github.com/xingfupeng/test.git

改为:

[remote "origin"]
url = https://xingfupeng@github.com/xingfupeng/test.git

再次git push,弹出框输入密码,即可提交