前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >git: non-fast-forward errors

git: non-fast-forward errors

作者头像
JNingWei
发布2018-09-28 11:33:22
1.6K0
发布2018-09-28 11:33:22
举报
文章被收录于专栏:JNing的专栏

遇到的问题

代码语言:javascript
复制
$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com': 
To https://github.com/UserName/tool.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/UserName/tool.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.

于是我试了 git pull ,跳出来让我 set up-stream ,set 完依然报错。

经过上网查阅,在 help.github.com 上找到了解决方案:

这里写图片描述
这里写图片描述

该方案解决了我遇到的 non-fast-forward errors 问题。

实验代码

代码语言:javascript
复制
$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com': 
To https://github.com/UserName/tool.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/UserName/tool.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.

$ git pull origin master
From https://github.com/UserName/tool
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 README.md | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com': 
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 700 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
To https://github.com/UserName/tool.git
   0e079c8..98a504b  master -> master

$  


本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017年11月09日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 遇到的问题
  • 实验代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档