Git push -u orign master 提示hint: not have locally. This is usually caused by another repository push
- 一、情景
- 1.在GitHub上创建一个仓库A,并且初始化了readme.md这个文档.
- 2.在本地用Git Bash初始化仓库A(一开始没有从GitHub上拉下来).
git init /* 初始化一个空的仓库*/
-
3.在本地仓库新建一个文件 test.txt,并且提交到本地仓库.
git add test.txt /* 把test.txt设为仓库跟踪文件 */
git commit -m “测试第一次 test.txt” /* 提交文件并且追加备注 */ -
4.把本地仓库提交到远程仓库master 分支
git push git@github.com:用户名/仓库名 master
提交失败:not have locally. This is usually caused by another repository push - 二、原因
- 本地仓库跟远程仓库的版本不一样导致的,因为执行在步骤1的时候,远程的版本库会有个“commit readme.md”这个操作记录,本地仓库是不知道你有这个提交的,也就是说这个记录没在本地仓库是不存在的,所以俩个版本是不一致的.
- 三 、解决方法
-
A). 先更新本地版本在提交
- 利用 git pull 更新本地版本库.
- 再 利用git push命令把本地仓库推送至远程仓库.
-
B). 强制覆盖
- 加上 -f 参数 强制覆盖
git push -f
可以参考链接:http://stackoverflow.com/questions/20939648/issue-pushing-new-code-in-github
Git push -u orign master 提示hint: not have locally. This is usually caused by another repository push的更多相关文章
- hint: not have locally. This is usually caused by another repository pushing
git 提交代码前先pull代码,否则会报如下错误 wangju@wangju-HP-348-G4:~/test/reponselogiccheck$ git statusOn branch mast ...
- Git error: hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused b
hint: Updates were rejected because the remote contains work that you dohint: not have locally. This ...
- Git error: hint: Updates were rejected because the remote contains work that you do hint: not have locally
hint: Updates were rejected because the remote contains work that you dohint: not have locally. This ...
- idea关联git后 Git上传项目提示Push rejected: Push to origin/master was rejected解决办法
当所有的东西都配好以后 就是不上数据 解决方案是在所属右键 点击Git BashHere后 输入:git pull origin master –allow-unrelated-historie ...
- Git上传项目到码云提示Push rejected: Push to origin/master was rejected
感谢大佬:https://blog.csdn.net/weixin_41499217/article/details/82985582 Push rejected: Push to origin/ma ...
- Push to origin/master was rejected (Git提交错误)
[问题描述] 在使用Git Push代码的时候,会出现 Push to origin/master was rejected 的错误提示. 在第一次提交到代码仓库的时候非常容易出现,因为初始化的仓库和 ...
- Push to origin/master was rejected (Git提交错误)(转)
[问题描述] 在使用Git Push代码的时候,会出现 Push to origin/master was rejected 的错误提示. 在第一次提交到代码仓库的时候非常容易出现,因为初始化的仓库和 ...
- Git出现提交错误--Push to origin/master was rejected(转)
Step1:出现的问题? 在使用Git Push代码的时候,会出现Push to origin/master was rejected 的错误提示.在第一次提交到代码仓库的时候非常容易出现,因为初始化 ...
- git push -u origin master error: failed to push some refs to
1.问题描述 $ git push -u origin master To github.com:[github_name]/[github_repository_name].git ! [rejec ...
随机推荐
- Python2.7-textwrap
textwrap主要针对英文的文本 模块内方法: wrap(text[, width, ...]),把text分成每行width长,返回一个列表,没有结尾的\n.fill(text[, width, ...
- Kafka设计解析(二十一)Kafka水位(high watermark)与leader epoch的讨论
转载自 huxihx,原文链接 Kafka水位(high watermark)与leader epoch的讨论 本文主要讨论0.11版本之前Kafka的副本备份机制的设计问题以及0.11是如何解决的. ...
- Jmeter之目录结构
首先得了解一下这些东西,以后才能快速的找到某些配置文件进行修改(举个例子,改配置只是其中之一) 一.bin目录examples: 目录中有CSV样例 jmeter.bat windows的启动文件 ...
- php初进一个项目组,使用几个函数帮忙熟悉流程
初进一个项目组的时候,可能对他的框架啊神马不熟悉的.有时候类里又有各种魔术方法的使用,IDE还跳转不过去对象的方法.这时候很多php内置函数就可以帮上些忙了. 1. instanceof 2. get ...
- EXCEL2007出错了无法使用文档中的ActiveX 控件
EXCEL2007出错了无法使用文档中的ActiveX 控件虽说是很久之前的问题,但是正确的解决方法和原因如下!原因:系统update之后出现的问题解决方法:删除C:\Users\[username] ...
- java web classpath
在使用ssh等框架开发web程序时配置文件(xml和properties)存放的路径一般为src下,当部署程序时则必须存在于classes路径下,具体如下 src不是classpath, WEB-IN ...
- go语言之行--结构体(struct)详解、链表
一.struct简介 go语言中没有像类的概念,但是可以通过结构体struct实现oop(面向对象编程).struct的成员(也叫属性或字段)可以是任何类型,如普通类型.复合类型.函数.map.int ...
- 20155207 EXP7 EXP8 EXP9 实验补交
20155207 EXP7 EXP8 EXP9 实验补交 20155207 EXP7 网络欺诈技术防范 20155207 EXP8 Web基础 20155207 <网络对抗> Exp9 W ...
- 20155316 Exp1 PC平台逆向破解(5)M
前绪 实验收获与感想 初步从三个途径了解了什么是缓冲区溢出以及如何简单实现它,对汇编与反汇编有更直观的了解. 什么是漏洞?漏洞有什么危害? 漏洞是指机器体制设计时所没有顾及到的.可以被利用的bug,放 ...
- C#_添加xml文件
引用:System.Xml; XmlDocument doc = new XmlDocument(); XmlElement Root = doc.CreateElement("Root&q ...