idea的项目连接了一个现有的gitee仓库(该仓库不是空白的仓库,之前有老项目的代码push上去。因为idea误操作导致老项目许多模块丢失,因此才重新创建新项目,连接原有的同一个gitee仓库),新项目push失败报错push rejected 具体如下:
02:28:19.482: [ChatGPT] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
error: failed to push some refs to 'gitee.com:chanrian/chat-gpt.git'
To gitee.com:chanrian/chat-gpt.git
! refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
Done
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
02:28:43.025: [ChatGPT] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
error: failed to push some refs to 'gitee.com:chanrian/chat-gpt.git'
To gitee.com:chanrian/chat-gpt.git
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
! refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
hint: 'git pull ...') before pushing again.
Done
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
查了一些资料有的说是git冲突问题,于是git remote -v查看连接的仓库,发现出来有两个,这样是正常的吗?
也有一些教程说要先pull拉取再提交,尝试过后也不行,如下:
D:\java\chatGPT_worksplace\ChatGPT> git pull origin master --allow-unrelated-histories
From gitee.com:chanrian/chat-gpt
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
.idea/.gitignore
.idea/compiler.xml
//这里中间省略类似的文件路径
.idea/libraries/Maven__org_springframework_spring_web_6_1_4.xml
.idea/libraries/Mav
Aborting
Merge with strategy ort failed.
D:\java\chatGPT_worksplace\ChatGPT>git push origin master
To gitee.com:chanrian/chat-gpt.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'gitee.com:chanrian/chat-gpt.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
请问这是什么问题呢,应该如何才能成功push到gitee仓库上呢