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' 的错误. 解决方法 ...
随机推荐
- Java学习:泛型简介
泛型 泛型:是一种未知的数据类型,当我们不知道使用什么数据类型的时候,可以使用泛型 泛型也可以看出是一个变量,用来接受数据类型 E e : Element 元素 T t : Type 类型 Array ...
- MVC中使用SignalR打造酷炫实用的即时通讯功能(轉載)
資料來源:http://www.fangsi.net/1144.html 前言,现在这世道写篇帖子没个前言真不好意思发出来.本贴的主要内容来自于本人在之前项目中所开发的一个小功能,用于OA中的即时通讯 ...
- LeetCode-SQL(一)
1.组合两个表 表1: Person +-------------+---------+| 列名 | 类型 |+-------------+---------+| Person ...
- Schnorr签名介绍
Schnorr签名介绍 来源 https://panzhibiao.com/2019/02/28/schnorr-sigature/ https://github.com/bitcoin/bitcoi ...
- jsp,servlet文件上传问题完善
1. 上传文件时文件名中文乱码 upload.setHeaderEncoding("utf-8"); 有个疑惑: 不管设置不设置都不乱码,但是刘帅龙老师讲的时候出现了乱码 . 2. ...
- [Linux] 树莓派编译python3.7.4
python3.7.4 源码编译后遇到ssl错误: pip is configured with locations that require TLS/SSL, however the ssl mod ...
- Leetcode 297. Serialize and Deserialize Binary Tree
https://leetcode.com/problems/serialize-and-deserialize-binary-tree/ Serialization is the process of ...
- 模块化规范:AMD规范和CommonJs规范
为什么模块很重要? 因为有了模块,我们就可以更方便地使用别人的代码,想要什么功能,就加载什么模块. 但是,这样做有一个前提,那就是大家必须以同样的方式编写模块,否则你有你的写法,我有我的写法,岂不是乱 ...
- FreePascal - CodeTyphon 如何调整代码编辑器背景色?
当前版本的CodeTyphon默认背景色是黑色,看起来很不习惯,通过下面操作,修改了它的代码编辑器的背景色: 1,打开CodeTyphon的菜单“工具”->“选项”. 2,选择左侧列表项目“颜色 ...
- Nexus安装和使用
1.前言 最近项目需要搭建maven私服,方便管理后期团队成员使用上传自己的包,因此决定使用nexus来搭建私服,搭建好的nexus地址. 2.准备工作 阿里云服务器ECS一台 1核CPU 2G内存( ...