使用idea遠程push代碼rejected解決方法

今天在idea寫了個項目,而後想着將它上傳到個人github中.
因而先在github中新建了一個repostory,
而後在idea的Terminal使用git命令git

git init
git add .
git commit -m '第一次提交'
而後將代碼於github中的倉庫關聯

以上都沒有問題
在git push時出錯了github

Push rejected: Push to origin/master was rejectedweb

使用 git config --global --list查看git信息 沒問題
因而猜測是權限問題,網上google查找解決方法以下:ide

緣由:
首先是你的項目中有和和歷史不符的東西
Push rejected: Push to origin/master was rejected
推拒絕:推送到起源/主人被拒絕
直接是解決辦法,直接打開你要上傳代碼的文件夾位置鼠標右鍵git Bash Here而後直接下面兩行命令解決問題svg

git pull origin master –allow-unrelated-histories
git push -u origin master -f