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
随机推荐
- mysql常用引擎
经常用MySQL数据库,但是,你在用的时候注意过没有,数据库的存储引擎,可能有注意但是并不清楚什么意思,可能根本没注意过这个问题,使用了默认的数据库引擎,当然我之前属于后者,后来成了前者,然后就有了这 ...
- Nuxt.js入门学习
Nuxt.js简单的说是Vue.js的通用框架,最常用的就是用来作SSR(服务器端渲染).再直白点说,就是Vue.js原来是开发SPA(单页应用)的,但是随着技术的普及,很多人想用Vue开发多页应用, ...
- python接口测试
引入unittest框架 get请求 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #coding: utf-8 import un ...
- JS利用async、await处理少见的登录业务逻辑
在用uniapp开发一个项目时,有这样一个需求:用户首次登录后,uniapp自动保存用户名密码,之后不管是再次打开项目(打开项目时登录状态已失效)还是 请求接口(接口返回登录失效)时,都会先自动默认的 ...
- SQL SERVER 字符串函数 STRING_SPLIT()
定义: STRING_SPLIT()函数根据指定的分隔符将字符串拆分为子字符串行. ※STRING_SPLIT 要求兼容性级别至少为 130. (即SSMS 2016及以上版本) ※级别低于 130 ...
- F12的用法
F12在Web测试中十分重要,可以定位元素(UI自动化常用),查看网页响应时间/数据(定位BUG,测单页面响应时间→性能) Elements 点击这个按钮,将光标移至“Google”图片位置并点击,右 ...
- IoC框架介绍
转载自:http://blog.csdn.net/wanghao72214/article/details/3969594 1 IoC理论的背景 我们都知道,在采用面向对象方法设计的软件系统中, ...
- 前端vue项目执行npm install 报错cd() never called()
前端我刚开始接触Vue,从GitHub上下载了代码程序,但缺少一些插件,用vscode打开并下载插件执行报错cd() never called! 解决的方式 1.执行cmd命令行不要再vscode里执 ...
- javaIO——StringReader & StringWriter
上一篇概述篇说过,一个IO对象是指一个可以被关闭的数据源或者目标,那么StringReader和StringWriter就是一个字符串源和字符串目标. 1. StringtReader: 文档说:St ...
- css的一些基础方法
1.css样式表分别有: 内联样式表 <!DOCTYPE html> <html lang="en"> <head> <meta char ...