git 无法push远程仓库 Note about fast-forwards
问题
push远程仓库时,经常报出下面的错误,导致操作失败,让我们来看看怎么解决。
To github.com:zwkkkk1/chatroom.git! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:zwkkkk1/chatroom.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.
错误:non-fast-forward
远程仓库:origin
远程分支:master
本地分支:master
解决方案
Git 已经提示我们,先用 git pull
把最新的内容从远程分支(origin/master
)拉下来,然后在本地 merge
,解决 conflict
,再 push
。
不过,在 git pull
时,还有其他的错误,我们分别看看可能出现的错误。
fatal: refusing to merge unrelated histories
此项错误是由于本地仓库和远程有不同的开始点,也就是两个仓库没有共同的 commit 出现的无法提交。这里我们需要用到 --allow-unrelated-histories
。也就是我们的 pull 命令改为下面这样的:
git pull origin master --allow-unrelated-histories
如果设置了默认分支,可以这样写
git pull --allow-unrelated-histories
There is no tracking information for the current branch.
完整报错代码可能是这样的:
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
原因是没有指定本地 master
分支和远程 origin/master
的连接,这里根据提示:
git branch --set-upstream-to=origin/master master
产生冲突
pull
还可能产生 conflict
,这里需要自己手动解决冲突再 merge
,这里不过多介绍。
成功 git pull
之后,然后就可以成功 git push
了~~
git 无法push远程仓库 Note about fast-forwards相关推荐
- git 无法push远程仓库 Note about fast-forwards 问题解决
git push 远程仓库时,出现以下类似错误,'Note about fast-forwards' in 'git push --help' for details. To https://gi ...
- git 无法 push 远程仓库 【Note about fast-forwards】
git 无法push远程仓库 Note about fast-forwards 提出问题 基本介绍 解决方案 提出问题 git push 远程仓库时,经常报出如下错误,导致无法将本地仓库中的内容提交到 ...
- Git撤销对远程仓库的push 或 Git撤销对远程仓库的commit提交
Git撤销对远程仓库的push 或 Git撤销对远程仓库的commit提交 [一]撤销push 执行 git log 查看日志,获取需要回退的版本号 执行 git reset –-soft <版 ...
- 使用git拉取远程仓库代码
git拉取远程仓库代码 引言: 项目需要在阿里云里面拉取代码,本来以为自己会,结果好几歩都出错了,这里记录一下步骤 下载安装好git,打开Git Bash Here,进行初始化三步. 1.git in ...
- git添加/删除远程仓库
注意:仓库只有管理员建的你才有权限上传,不然自己建的也没用,没权限上传 1.远程仓库路径查询 git remote -v 2.添加远程仓库 git remote add origin <你的项目 ...
- Git 本地与远程仓库同步操作
git fetch 做了些什么 git fetch 完成了仅有的但是很重要的两步: 从远程仓库 下载 本地仓库中缺失的 提交记录 更新远程分支指针(假设为 o/master) git fetch 实际 ...
- 使用git同步到远程仓库
使用git同步到远程仓库 在仓库所在的目录(D:\temp\git\repository)点击右键选择"Git Bash Here",启动git bash程序. 然后在git ba ...
- git连接github远程仓库
一:设置用户名和邮箱 打开Git Bash Here 输入: git config --global user.name '用户名' git config --global user.email '邮 ...
- git 本地与远程仓库出现代码冲突解决方法
git 本地与远程仓库出现代码冲突解决方法 参考文章: (1)git 本地与远程仓库出现代码冲突解决方法 (2)https://www.cnblogs.com/heaven-xi/p/9703566. ...
最新文章
- 本地文件与服务器传输,云服务器 与本地文件传输
- delphi中checkcombobox最大长度_并行光信号传输中的信道间传播时间偏差
- org.dom4j.DocumentException: 20 Nested exception: 20
- 安装rime中文输入法
- 架构专家梁勇:哈啰在分布式消息治理和微服务治理中的实践
- Google research 一行预处理代码,让你的CV模型更强!
- 【CCCC】L2-021 点赞狂魔 (25分),,模拟水题,map数组,间接排序
- Python之字符串正则匹配
- Webpack框架知识整理——Modules
- 卸载、Jlink驱动不成功,提示“could not open INSTALL.LOG file” 解决办法
- 带你认识!通用网络安全开发包(Libdnet)
- 基金常用的分析指标:跟踪误差率、信息比率、夏普比率到底是什么意思?
- android解析包时出现问题怎么解决方法,手机安装APP提示解析错误怎么办?解析包时出现问题如何解决?...
- BTA | 元道:去中心化第一波,Web已死,互联网怎能永生?
- 嵌入式计算机的发展阶段,嵌入式系统的定义与发展历史
- C语言学习笔记01:C语言基础语法_变量类型_类型转换
- C/C++浮点数格式——IEEE754标准
- Android 虚拟机与类加载机制
- 解决QProcess启动进程后kill无效
- vue字符串列表转换数组_vue 数组对接字符串 传值时候,join(',') 一下 watch
热门文章
- 排列熵算法举例子理解
- python vbscript_python vbscript_VBScript学习笔记
- Linux的优缺点,Linux与windows的区别
- C语言求阶乘之和(S=1!+2!=...+n!)
- Redhat 安装squirrelmail
- linux上wds部署服务,WDS服务器的部署与配置
- Access中创建含有OLE对象列的表
- USB console线,USB转RJ45路由器调试线的前世今生
- Fidller 抓包工具-手机代理抓包
- nutch代码分析第二篇——crawl.crawl