git push 403的解决方法

创建一个GitHub.com项目,Push时总是提示403错误:

[amonest@localhost ~]$ git config --global user.name amonest
[amonest@localhost ~]$ git config --global user.email xxx@xxx.com

[amonest@localhost ~]$ git clone https://github.com/amonest/python-scripts.git
[amonest@localhost ~]$ cd python-scripts

... 省略中间代码修改过程 ...

[amonest@localhost python-scripts]$ git remote add orginal https://github.com/amonest/python-scripts.git
[amonest@localhost python-scripts]$ git push orginal master
error: The requested URL returned error: 403 while accessing https://github.com/amonest/python-scripts.git/info/refs

fatal: HTTP request failed

网上搜索了半天,终于找到解决方法:《Pushing to Git returning Error Code 403 fatal: HTTP request failed

[amonest@localhost python-scripts]$ git remote set-url orginal https://amonest@github.com/amonest/python-scripts.git
[amonest@localhost python-scripts]$ git push orginal master

稍等一下就会提示输入密码:

这样就OK了。

与Git有关的一些文档:

原文地址:https://www.cnblogs.com/eastson/p/2612880.html