Intellij IDEA项目上传到GitHub错误 push to origin/master was rejected解决方案

版权声明:欢迎分享转载 我可能会失败,但我不会一直失败 https://blog.csdn.net/u012637358/article/details/81042866

解决方案如下:

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自己的项目,成功!!!

猜你喜欢

转载自blog.csdn.net/u012637358/article/details/81042866