学无先后,达者为师

网站首页 编程语言 正文

如何解决error: failed to push some refs to ‘xxx(远程库)‘

作者:哈斗 更新时间: 2022-04-14 编程语言

当push代码时,出现如下错误:

jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git push origin faceIdentify
To http://192.168.88.98/project/freamwork.git
 ! [rejected]        faceIdentify -> faceIdentify (fetch first)
error: failed to push some refs to 'http://192.168.88.98/project/freamwork.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first 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.

出现该错误的原因具体我也不太清楚,也没有仔细研究,当出现该错误时,可以使用git pull命令,然后再按照流程提交一遍即可。

//**先使用git pull 命令**
jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git pull
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), 9.03 KiB | 1.00 MiB/s, done.
From http://192.168.88.98/project/freamwork
   2794f0d..70c25c6  faceIdentify -> origin/faceIdentify
Merge made by the 'recursive' strategy.
 face.sql | 532 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 532 insertions(+)
 create mode 100644 face.sql

//**重新提交一遍**
jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git status
On branch faceIdentify
Your branch is ahead of 'origin/faceIdentify' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git add .

jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git commit -m "merge"
On branch faceIdentify
Your branch is ahead of 'origin/faceIdentify' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
g
jinshu@DESKTOP-L5OTKGN MINGW32 /c/jinshu/develop/projects/freamwork (faceIdentify)
$ git push -u origin faceIdentify
Enumerating objects: 60, done.
Counting objects: 100% (43/43), done.
Delta compression using up to 4 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (24/24), 2.83 KiB | 723.00 KiB/s, done.
Total 24 (delta 10), reused 0 (delta 0)
To http://192.168.88.98/project/freamwork.git
   70c25c6..1cd4207  faceIdentify -> faceIdentify
Branch 'faceIdentify' set up to track remote branch 'faceIdentify' from 'origin'.

原文链接:https://blog.csdn.net/weixin_45151960/article/details/109051883

栏目分类
最近更新