错误提示:

error: The requested URL returned error: 403 Forbidden while accessing https://nanfei9330@github.com/nanfei9330/newsPM2.git/info/refs

解决方案,进入项目目录

vim .git/config

       fetch = +refs/heads/*:refs/remotes/origin/*
        url=https://github.com/yourid/example.git

修改为:

      fetch = +refs/heads/*:refs/remotes/origin/*
        url=https://yourid@github.com/yourid/example.git

再次尝试git push origin ....在弹出框输入github到登录密码即可提交成功

 

如果不想每次push都输入密码可以把url 那行改成ssh协议(注意下面红色部分是斜杠不是引号)
url = ssh://git@github.com/yourid/example.git

 

git push错误解决方案_斜杠