git push error. ! [rejected] master -> master (non-fast-forward)
错误提示:
Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)
$ git push
To github.com:AnthonyGIS/video_frame.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:AnthonyGIS/video_frame.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. Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)
问题(Non-fast-forward)的出现原因在于:git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去。
方法1
强推,即利用强覆盖方式用你本地的代码替代git仓库内的内容。
如果远程仓库是刚建的,没有代码 或者你确定远程仓库中的代码没有用了,可以这样操作,尽量避免这种操作方法。
git push -f
方法2
先把git的东西fetch到你本地然后merge后再push。
$ git fetch
$ git merge
如果在git merge的时候出现
fatal: refusing to merge unrelated histories
可以使用,git pull origin master --allow-unrelated-histories,来处理一下。
继续git merge
若,出现:
fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you merge.
是我们没有提交当前的变化, git add .,git commit -am "提交信息",然后再来一次git merge,然后ok.
最后 git push。(git push origin master)。
提示Already up-to-date. 就好了,上传完成。
参考
git 推送错误 ! [rejected] master -> master (non-fast-forward)解决方案
git push error. ! [rejected] master -> master (non-fast-forward)的更多相关文章
- git push error: ! [rejected] failed to push some refs to . . .
报错情况: 报错原因:远程库与本地库不一致造成的,需要把远程库同步到本地库! 解决办法: git pull --rebase origin master 这条指令是将远程库中的更新合并到本地库,--r ...
- Git Push:error: Couldn't set refs/remotes/origin/master;error: update_ref failed for ref 'refs/remot
作者:荒原之梦 原文链接:http://zhaokaifeng.com/?p=543 今天使用Git Push代码时产生错误: Rename from 'XXXX/.git/refs/remotes/ ...
- Linux] Git: push 出错的解决 master -> master (branch is currently checked out)
在使用Git Push代码到数据仓库时,提示如下错误: [remote rejected] master -> master (branch is currently checked out ...
- GIT问题,error:src refspec master does not match any
将本地GIT版本库PUSH到一个GITHUB上一个空的版本库时可能会出现如下错误error:src refspec master does not match any原因: 本地版本库为空, 空目录不 ...
- Git提交代码报错Git push error:src refspec XXX matches more than one解决方案
Git提交代码push时,报错这个 error: src refspec master matches more than one. error: failed to push some refs t ...
- git push ERROR: missing Change-Id in commit message footer
今天上传代码时候报告错误:$ git push origin HEAD:refs/for/branch*Counting objects: 7, done.Delta compression usin ...
- git push error: RPC failed; result=56, HTTP code = 0 ,the remote end hung up unexpectedly
git push的时候发生标题上面的错误,不知道怎么解决.搜索了下stackoverflow,上面说是http的postBuffer不够导致的. 要运行以下命令: git config --globa ...
- 解决:git push error: failed to push some refs to
出现错误的原因是github中的README.md文件不在本地代码目录中. 也就是说我们需要先将远程代码库中的任何文件先pull到本地代码库中,才能push新的代码到github代码库中. 使用如下命 ...
- Git push error: http 411的解决方案总结
目录 一.事故现场 二.事故原因 三.解决方案 一.事故现场 git push 的时候报错如下: 将分支推送到远程存储库时遇到错误:Git failed with a fatal error, the ...
随机推荐
- 003-guava 集合-不可变集合
一.概述 二.使用 2.1.不可变集合 1.为什么使用不可变集合 不可变对象有很多优点,包括: 当对象被不可信的库调用时,不可变形式是安全的:不可变对象被多个线程调用时,不存在竞态条件问题不可变集合不 ...
- doris: shell invoke .sql script for doris and passing values for parameters in sql script.
1. background in most cases, we want to execute sql script in doris routinely. using azkaban, to l ...
- 如何发布自己的APP到Google Play上
如何发布自己的APP到Google Play上 参考链接: https://justforuse.github.io/blog/zh-cn/2019/08/publish-your-own-app-t ...
- Delphi中进行延时的4种方法
1.挂起,不占CPUsleep2.不挂起,占cpuprocedure Delay(msecs:integer);varFirstTickCount:longint;beginFirstTickCou ...
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
问题出现的原因: MySQL 5.7.5及以上功能依赖检测功能.如果启用了ONLY_FULL_GROUP_BY SQL模式(默认情况下),MySQL将拒绝选择列表,HAVING条件或ORDER BY列 ...
- 删除SQL约束的方法
在SQL数据库中,如果需要删除表约束,应该如何操作呢?下面就将为您介绍删除SQL表约束的方法,供您参考,希望对您有所帮助. --1)禁止所有表约束的SQL select 'alter table '+ ...
- 【linux学习笔记五】帮助命令
man //查看ls作用 man ls man -f命令 相当于 whatis命令 --help ls --help help help shell help cd info详细命令帮助
- RobotFramework:查询条件为最近一个月的数据(2019-07-09 00:00:00.000 到 2019-08-07 23:59:59.999)
自动化测试中遇到,默认查询条件为最近一个月,所以起始时间就应该为(2019-07-09 00:00:00.000 到 2019-08-07 23:59:59.999) test ${current_ ...
- 【计算机视觉】SeetaFace Engine开源C++人脸识别引擎
SeetaFace Engine是一个开源的C++人脸识别引擎,它可以在不依赖第三方的条件下载CPU上运行.他包含三个关键部分,即:SeetaFace Detection,SeetaFace Alig ...
- 【CUDA开发】CUDA开发琐碎知识
## 一维矩阵的加 //实现一个一维1*16的小矩阵的加法. //矩阵大小:1*16 //分配一个block,共有16个线程并发. #include <stdio.h> #includ ...