git push 出现fatal: unable to access 'http://xxx': The requested URL returned error: 403

发布时间 2023-03-30 10:38:47作者: 凌风子

问题:

cch:requsetDatas leo$ git push origin master

remote: Permission to bbb/requsetDatas.git denied to aaa.

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

解决方法:

1:终端输入:vim .git/config 就是打开git的config配置文件。

2:找到下面一句

[remote "origin"]

url = https://github.com/bbb/example.git

修改为:

[remote "origin"]

url = https://bbb@github.com/bbb/example.git

保存并退出。(注意颜色字体)

3:再次git push origin master,提示输入密码,OK。