Git发现git push origin master 报错的解决方法
更新时间:2017年11月02日 11:29:59 作者:Kangvcar
本篇文章主要介绍了Git发现git push origin master 报错的解决方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
git push origin master 报错的解决方法,分享给大家,具体如下:
错误提示如下
[root@linux1 php]# git push -u origin master To git@github.com:kangvcar/Results-Systems--PHP.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'git@github.com:kangvcar/Results-Systems--PHP.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first merge the remote changes (e.g., hint: 'git pull') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
原因
GitHub远程仓库中的README.md文件不在本地仓库中。
解决方案1
我们只需加上 -f 参数即可push成功
[root@linux1 qimo]# git push -f warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Counting objects: 53, done. Compressing objects: 100% (53/53), done. Writing objects: 100% (53/53), 1.35 MiB | 55.00 KiB/s, done. Total 53 (delta 8), reused 0 (delta 0) remote: Resolving deltas: 100% (8/8), done. To git@github.com:kangvcar/Results-Systems--PHP.git + fbe05e8...70b187d master -> master (forced update)
解决方案2
我们只需加上 --rebase 参数然后再重新 push 一次即可
[root@linux1 qimo]# git pull --rebase origin master [root@linux1 qimo]# git push -u origin master
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
- git push时卡住的解决方法(长时间不报错也不自动退出)
- git本地分支和stash内容报错消失的问题
- 关于提交项目到gitee报错Push to origin/master was rejected的问题
- 有关pycharm登录github时有的时候会报错connection reset的问题
- Git使用小坑 Out of memory错误的解决方法
- git pull时冲突的几种解决方式(小结)
- idea+git合并分支解决冲突及详解步骤
- git在idea中的冲突解决方法(非常重要)
- git 报错:OpenSSL SSL_read: Connection was reset, errno 10054 解决方法
相关文章
使用 Koa + TS + ESLlint 搭建node服务器的过程详解
这篇文章主要介绍了使用 Koa + TS + ESLlint 搭建node服务器,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2022-05-05php.ini 启用disable_functions提高安全
如果想保证服务器的安全,请将这个函数加到disable_functions里或者将安全模式打开吧,在安全模式下dl函数是无条件禁止的2009-07-07基于 ZooKeeper 搭建 Hadoop 高可用集群 的教程图解
Hadoop 高可用 (High Availability) 分为 HDFS 高可用和 YARN 高可用,两者的实现基本类似,但 HDFS NameNode 对数据存储及其一致性的要求比 YARN ResourceManger 高得多,所以它的实现也更加复杂,下面给大家详细介绍,感兴趣的一起看看吧2019-06-06
最新评论