git 提交代码报错failed to push some refs to 解决笔记
Administrator@SC- MINGW64 /e/gitrepository (master)
$ git push django master
To github.com:zgc137/django.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:zgc137/django.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.
此时很多人会尝试下面的命令把当前分支代码上传到master分支上。
$ git push -u origin master
但依然没能解决问题
出现错误的主要原因是github中的README.md文件不在本地代码目录中
origin是自己在git上创建的仓库名字,我的创建的名字是django
可以通过如下命令进行代码合并【注:pull=fetch+merge]---取+合并
git pull --rebase origin master
注:上传代码到远程库,上传之前最好先Pull一下,再执行命令: git pull origin master
$ git pull --rebase django master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
From github.com:zgc137/django
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: wrote a readme file
Applying: 天天生鲜项目+练习
即pull成功,
接着执行:git push origin master
$ git push -u django master
Enumerating objects: , done.
Counting objects: % (/), done.
Delta compression using up to threads
Compressing objects: % (/), done.
Writing objects: % (/), 1.44 MiB | 782.00 KiB/s, done.
Total (delta ), reused (delta )
remote: Resolving deltas: % (/), done.
To github.com:zgc137/django.git
eecd635..07115e0 master -> master
Branch 'master' set up to track remote branch 'master' from 'django'.
git 提交代码报错failed to push some refs to 解决笔记的更多相关文章
- git提交代码报错 trailing whitespace的解决方法
1. git提交代码报错 trailing whitespace 禁止执行pre-commit脚本 进入到项目目录中 chmod a-x .git/hooks/pre-commit 2.git提交代码 ...
- 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 报错:failed to push some refs to 'git@git.xxxx:devops/thor.git'
error: failed to push some refs to 'git@git.caicaivip.com:devops/thor.git' hint: Updates were reject ...
- git报错failed to push some refs to 'git@github.com:Markprint/github.git'
这个不知名小错误用了我两天的空余时间mmp 就是这里报的错 输入 git push origin master -f 解释为: 远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到 ...
- git提交代码报:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists.
git提交代码报错,提示:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists. 具体截图如下: 在.git目录 ...
- svn 提交代码报错
svn 提交代码报错 最近新安装了TortoiseSvn 1.92,在上传代码,其中有新增加的文件,出现如下错误: 解决方法: 1.用vs生成patch文件 2.生成的patch文件中讲nonexis ...
- 提交代码报错 error: failed to push some refs to
在本人想把本地的分支推送到远程仓库时,突然出现了错误提醒error: failed to push some refs to....心里一咯噔,推不上去这还得了,手比脑快地就去google了一下. 然 ...
- git提交远程报错[rejected] master -> master (fetch first)
1 先下载git for windows 然后一直点下一步安装. 2 安装之后,选择git gui.生成ssh 链接 git 公钥. 用命令也可以: $ ssh-keygen -t rsa -C &q ...
- Git错误:error:failed to push some refs to 'git@gitee.com:name/project.git'
大家在通过本地仓库上传文件到远程仓库时,会报出 error:failed to push some refs to 'git@gitee.com:name/project.git' 的错误. 解决方法 ...
随机推荐
- 立个铁矿石的flag,从7月初开始,铁矿石的库存,可能要进入累库存阶段了.
从发货量倒推出的到货量,用来评估未来的到货量 推测的到港量与实际北方6港到港量的关系 通过月度到港量,估计出北方6港对全国到港量的正确性. 悲观的库存预期 乐观的库存预期 大概率的情况吧
- NetCore 统一处理 webapi 返回null 转为“”
数据库中部分表字段允许空值,则代码中实体类对应的字段类型为可空类型Nullable<>,如int?,DateTime?,null值字段序列化返回的值都为null,前端对应字段赋值需要做nu ...
- Spring Web MVC框架简介
Web MVC framework框架 Spring Web MVC框架简介 Spring MVC的核心是`DispatcherServlet`,该类作用非常多,分发请求处理,配置处理器映射,处理视图 ...
- docker run VS docker exec 的区别
“docker run”和“docker exec”都是 Docker 容器中用于执行的命令.然而,在不同的情况下,它们的使用有着本质上的区别. “docker run”命令 “docker run” ...
- Java IO---序列化和反序列化
一.序列化和反序列化介绍 什么是序列化和反序列化? 序列化就是将对象转换为字节序列的过程. 反序列化就是将字节序列恢复为对象的过程. 序列化的用途在哪? 通常情况下,序列化有两个用途: 将对象 ...
- 自动化测试模型 Selenium IDE Selenium Gird2
1.线性测试 每个测试脚本相对独立,且不产生其他依赖与调用,其实就是单纯的来模拟用户完整的 操作场景.前一篇所写的测试脚本就属于线性测试. 优点:每个脚本完整且独立 缺点:测试用例的开发与维护成本高 ...
- idea2018破解
准备:ideaIU-2018.1.4.exe 安装程序 JetbrainsCrack-2.10-release-enc.jar 破解jar包 第一步:打开安装目录/bin,找到idea.exe.vmo ...
- Api测试-为postman自动添加cookie
使用postman来调试接口,会被buc-sso-csrf等拦截,需要自己挨个添加cookie,但是cookie又有失效时间,所以本篇介绍如何使用插件来自动获取cookie进行接口api测试 一.安装 ...
- fastjson 将json字符串转化成List<Map<String, Object>>
亲测可行,如下: JSON.parseObject(jsonstr, new TypeReference<List<Map<String, Object>>>() ...
- document.forms使用
定义:document.forms返回form表单的集合,包含了当前DOM结构中所有的form表单. 语法: . 获取当前DOM结构中的第一个form表单. document.forms[] . 获取 ...