git 解决 error: failed to push some refs to 'https://github.com/xxxx.git'
在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误
[root@foundation38 demo]# git push -u origin master
Username for 'https://github.com': xuefeilong
Password for 'https://xuefeilong@github.com':
To https://github.com/xuefeilong/test.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/xuefeilong/test.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决办法:
1: 进行push前先将远程仓库pull到本地仓库
$ git pull origin master #git pull --rebase origin master
$ git push -u origin master 2: 强制push本地仓库到远程 (这种情况不会进行merge, 强制push后远程文件可能会丢失 不建议使用此方法)
$ git push -u origin master -f 3: 避开解决冲突, 将本地文件暂时提交到远程新建的分支中
$ git branch [name]
# 创建完branch后, 再进行push
$ git push -u origin [name]
我使用的是直接加入参数-f,但是不推荐比较粗暴:
[root@foundation38 demo]# git push -u origin master -f
Username for 'https://github.com': xuefeilong
Password for 'https://xuefeilong@github.com':
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (13/13), 975 bytes | 0 bytes/s, done.
Total 13 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/xuefeilong/test.git
+ 5c057df...abfded5 master -> master (forced update)
Branch master set up to track remote branch master from origin.
转载 自 https://blog.csdn.net/sgsgy5/article/details/83689516
git 解决 error: failed to push some refs to 'https://github.com/xxxx.git'的更多相关文章
- git 报错:error: failed to push some refs to 'https://github.com/Anderson-An/******.git'(已解决)
提交push 报错: $ git push origin masterTo https://github.com/Anderson-An/******.git ! [rejected] master ...
- error: failed to push some refs to 'https://github.com/username/python.git'
解决error: failed to push some refs to 'https://github.com/bluepen/python.git' 当我们在使用git工具上传我们自己的代码时,可 ...
- 错误:error: failed to push some refs to 'https://github.com/pzq7025/KG.git'的解决办法
一.问题在进行[git push orgin master]的时候出现如下错误 ! [rejected] master -> master (non-fast-forward) error: f ...
- git push ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Operater9/guest' hint: Updates were rejected because the tip of your current bra
推送本地代码到github报错 git push报错 ! [rejected] master -> master (non-fast-forward) error: failed to push ...
- 【错误】上传新的项目出错 error: failed to push some refs to 'https://github.com/...
问题描述:在git bash中键入 $ git push origin master 进行提交的时候出现 如下错误: error: failed to push some refs to 'https ...
- git 本地推送远程仓库报错: error: failed to push some refs to 'https://github.com/yangtuothink/mxonline.git'
报错现象 添加远程仓库后 推送代码的时候报错 报错分析 远程代码和本地代码不匹配问题 远程初始仓库的创建有些默认 的 README什么的本地是没有的 需要先同步后再上传 报错解决 git push - ...
- git上传文件夹报错: ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/taminachen/rjxm.git' hint: Updates were rejected because the remote contains work
使用git上传本地文件夹到远程仓库,使用如下命令:git push -u origin master时报错 原因是在GitHub创建仓库时创建了readme文件,但是本地没有这个文件,造成本地目录与远 ...
- error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
在使用git 对源代码进行push到gitHub时可能会出错,信息如下 此时很多人会尝试下面的命令把当前分支代码上传到master分支上. $ git push -u origin master ...
- git/github error: failed to push some refs to 'https://github.com/shenhaha/cloudletter.git'
git 提交代码到github上报如下错误 报错分析: 解决方法: 关闭这两个设置 再次提交代码 success
随机推荐
- eNSP——Hybrid接口的应用
原理: Hybrid接口既可以连接普通终端的接入链路又可以连接交换机间的干道链路,它允许多个VLAN的帧通过,并可以在出接口方向将某些VLAN帧的标签剥掉. Hybrid接口处理VLAN帧的过程如下: ...
- mysql导入问题
今天在导入数据库的时候,发现此问题: 后来一查,是因为GTID_EXECUTED有值,而导出的文件中包含了SET @@GLOBAL.GTID_PURGED的操作,所以导入报错. 我们有两种方法解决 ...
- [转帖]Google Chrome 解决 “您的连接不是私密连接”
Google Chrome 解决 “您的连接不是私密连接” 和被毒霸劫持 自己搭建了 k8s的 dashboard 结果 chrome 最新版本的打不开了.. 百度了下 园友的解决方案很完美 这里面转 ...
- android 自动化测试 ---python wrapper(python 包装)
关于有道云笔记复制的东西不能直接copy到博客园,可以选择使用txt文件做个媒介 1.appium 2.monkeyrunner 3.uiautomator2 前面两种种方式都要加载androidsd ...
- java类和对象详解
类和对象 java 是面向对象的语言 即 万物皆对象c语言是面向过程语言 一.怎么去描述一个对象? (1)..静态的(短时间内不会改变的东西) 例如:外观,颜色,品牌 (2).动态的(动作) 可以干什 ...
- H5网页唤醒app,判断app安装
在阅读本文之前你首先应该对js有基本对掌握,并且对Scheme,intent有一定的理解.更多的是代码 上午给朋友做了一个产品引导页,但是需要判断ios系统的TestFlight是否安装,进行了goo ...
- python--关于正则表达式的学习小结
python中提供了re这个模块提供对正则表达式的支持. 一.正则表达式常用到的一些语法(并非全部): . 匹配任意单个字符 [...] 匹配单个字符集 \w 匹配单词字符,即[a-zA-Z0-9] ...
- 编写程序来实现实现strcat()功能
strcat(字符数组1,字符串2) 字符串2的内容复制连接在字符数组1的后面,其返回值为字符数组1的地址 /* strcat(字符数组1,字符串2) 字符串2的内容复制连接在字符数组1的后面,其返回 ...
- MySQL 聚合函数(四)检测功能依赖
源自MySQL 5.7 官方手册:12.20.4 Detection of Functional Dependence 本节提供了MySQL检测功能依赖的方式的几个示例.这些示例使用此表示法: {X} ...
- luogu4302字符串折叠题解--区间DP
题目链接 https://www.luogu.org/problemnew/show/P4302 分析 很明显一道区间DP题,对于区间\([l,r]\)的字符串,如果它的字串是最优折叠的,那么它的最优 ...