1. 程式人生 > >Intellij IDEA專案上傳到GitHub錯誤 push to origin/master was rejected解決方案

Intellij IDEA專案上傳到GitHub錯誤 push to origin/master was rejected解決方案

解決方案如下:

1.切換到自己專案所在的目錄,右鍵選擇GIT BASH Here或Idea中可使用Alt+F12

2.在terminl視窗中依次輸入命令:

D:\尋找手藝人\專案原始碼\craft-framwork>git pull
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/xzsyr/craft-framework
 * [new
branch] master -> origin/master There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with
: git branch --set-upstream-to=origin/<branch> master D:\尋找手藝人\專案原始碼\craft-framwork>git pull origin master From https://github.com/xzsyr/craft-framework * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories D:\尋找手藝人\專案原始碼\craft-framwork>git pull origin master --allow-unrelated-histories
From https://github.com/xzsyr/craft-framework * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md D:\尋找手藝人\專案原始碼\craft-framwork>

git pull

git pull origin master

git pull origin master –allow-unrelated-histories

3.在idea中重新push自己的專案,成功!!!