錯誤提示:
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