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' 的错误. 解决方法 ...
随机推荐
- mysql 中的日期格式。date_format( ) 转换格式
date_format( ) 转换格式 : 格式 描述 %a 缩写星期名 %b 缩写月名 %c 月,数值 %D 带有英文前缀的月中的天 %d 月的天,数值(00-31) %e 月的天,数值(0-31) ...
- java基础 接口常量
/** * 接口当中也可以定义"成员变量", 但是必须使用public static final三个关键字进行修饰 * 从效果上看,这其实就是接口的[常用] * 格式: * pub ...
- java之maven之初识maven
1.maven是一个项目管理工具. 包括项目创建.资源管理.项目运行.项目发布等功能. 2.为什么使用 maven? a. jar 依赖管理(升级.降级)等 b. 项目之间依赖管理 c. 资源文件管理 ...
- C# 字符串和字节数组转换
转自:http://blog.sina.com.cn/s/blog_683d60ff0100rhwk.html 定义string变量为str,内存流变量为ms,比特数组为bt 1.字符串转比特数组 ( ...
- 用lambda表达式写左联查询的示例
需要完成的查询逻辑:A表内联B表,B表左联C表,A表左联D表,并且 C表的TotalCount>23,D表的ClassHour>8,最后查出A表的Id,代码如下: IQueryable&l ...
- easydict的使用方法
easydict的作用:可以使得以属性的方式去访问字典的值 from easydict import EasyDict as edict a=['8',2,3]a=edict()a.f=99print ...
- 85.webpack的安装失败至成功
webpack怎么安装 1.安装node.js; 2.安装webpack: npm install webpack --save-dev : 注意:webpack 4x以上,webpack将命 ...
- Spring容器的refresh()介绍
Spring容器的refresh()[创建刷新]; 1.prepareRefresh()刷新前的预处理; 1).initPropertySources()初始化一些属性设置;子类自定义个性化的属性设置 ...
- rpm安装与yum安装的区别
linux下的安装包多为rpm安装包.通常安装方法为 rpm -ivh 包的路径+包名.rpm 其中参数-i为安装 -v显示信息 -h显示进度条.这三个参数基本捆绑使用rpm的路径不单可以是本地磁 ...
- Linux 常用命令(根据自己的理解随时更新)
1. linux 目录解释系统启动必须: /boot:存放的启动 Linux 时使用的内核文件,包括连接文件以及镜像文件. /etc:存放所有的系统需要的配置文件和子目录列表,更改目录下的文件可能会导 ...