git push异常整理 error: failed to push some refs to
程序员文章站
2022-07-11 08:29:33
...
目录
名称与 refs/heads/xxx 冲突
$ git push origin HEAD:feature/xujingjian-20210318-xj-1.5.0-122187
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To ssh://192.168.14.227:22/DefaultCollection/PSSCS/_git/app_peiwang_ionic_chat_2.0
! [remote rejected] HEAD -> feature/xujingjian-20210318-xj-1.5.0-122187 (名称与 refs/heads/feature 冲突)
error: failed to push some refs to 'ssh://192.168.14.227:22/DefaultCollection/_git/app_2.0'
这个异常提示信息很少,但已经指出了异常是“名称与 refs/heads/feature 冲突”,feature是要push分支xujingjian-20210318-xj-1.5.0-122187所在的文件夹。为什么会提示它呢?为了搞明白去远程仓库检查了一下,原来没有feature这个文件夹。解决办法:创建feature文件夹,或把分支Push到其他文件下面。
non-fast-forward(不能快速跟进)
$ git push origin HEAD:xujingjian-20210318-xj-1.5.0-122187
To ssh://192.168.14.227:22/DefaultCollection/_git/app_2.0
! [rejected] HEAD -> xujingjian-20210318-xj-1.5.0-122187 (non-fast-forward)
error: failed to push some refs to 'ssh://192.168.14.227:22/DefaultCollection/PSSCS/_git/app_peiwang_ionic_chat_2.0'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这个异常是non-fast-forward(不能快速跟进),就是说远程仓库已经有比本地仓库更新的commit。或许是你的同事先一步提交了代码。
解决办法:
- 先git pull origin xujingjian-20210318-xj-1.5.0-122187
- 如果有文件冲突先合并冲突,然后再git add 、git commit 、git push
推荐阅读
-
git push异常整理 error: failed to push some refs to
-
git push origin master 异常 error: failed to push some refs to ‘https://gitee.com/...
-
error: failed to push some refs to
-
Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......
-
git push 提交出现 failed to push some refs to
-
push时git报错 error: failed to push some refs to 'git@gitee.com:git_zn/jianli.git' 解决办法
-
Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......
-
git使用报错 ! [rejected] master -> master (fetch first) error: failed to push some refs to '略‘
-
解决error: failed to push some refs to 'XXXX'
-
git push 提交出现 failed to push some refs to