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 ...
随机推荐
- jpa实例
ORM框架新的JPA ORM规范:1)JPA为POJO提供持久化标准规范.2)JPA的使用:Hibernate与TopLink以及OpenJpa都提供了JPA的实现.3)JPA主要技术: A.ORM ...
- Ubuntu 重新安装声卡驱动
有的时候ubuntu 的声卡不能用,没有声音也不能使用麦克风,所有很困惑,查看声卡驱动的时候不显示声卡的驱动,所有我们要自己安装声卡驱动, 1.下载驱动包这是比较新的声卡驱动,1.0.20 $ wge ...
- android asmack调用MultiUserChat.getHostedRooms方法出现空指针的异常解决方案
今天在做即时通讯群聊时,调用MultiUserChat.getHostedRooms(conn, SmackTools.getInstance().conn.getServiceName());方法获 ...
- Android 网络请求超时处理方案
以用户登录为例介绍用户访问网络时的请求超时处理的两种方法: 1)使用android提供的工具类AsyncTask类,此类提供了一个AsyncTask.execute().get(timeout, un ...
- python:'ascii' codec can't encode character
python默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错,python没办法处理非ascii编码的, 此时需要自己设置python的默认编码,一般设置为u ...
- day66
今日内容: 1 orm介绍 1 tools--->Run manage.py Task python3 manage.py makemigrations 只需要敲命令:makem ...
- 搞个组装机:D
时间:2016年7月 主机:就是主机 整机:主机+显示器 推荐:自己组装,淘宝或者京东,或者去淘宝上的宁美国度.攀升兄弟看看. 4000多块配个电脑: 处理器:i5 4590 散片(发热量小) 111 ...
- 使用Git进行协同开发
用了一段时间github,一直想用时间来对git的使用来做一段笔记,前段时间比较忙,现在沉下心来学习也是极好的. 很多项目开发会采用git这一优秀的分布式版本管理工具来进行项目版本管理.因为git的使 ...
- 编译最新的SQLite 3.8.4.3为一个DLL
SQLite是一个小型数据库.特别适合于client应用程序使用,它的众多优点就不多说了.有兴趣的去搜索. 话说使用吧. 我们要使用.就须要调用它.如今一步一步来. 第一步:上SQLite官网http ...
- 使用clipboard插件实现div、textarea、input里面的内容复制到粘贴板
一.引用clipboard的js文件 二.编写代码.data-clipboard-action=“copy”,代表要执行的动作是复制.data-clipboard-target里面要是要选择复制的元素 ...