错误提示如下:

[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 matchingTo squelch this message and adopt the new behavior now, use:git config --global push.default simpleSee '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 - git push origin master 报错的解决方法相关推荐

  1. git push origin master报错的解决方法 常见git命令(待更新)

    git push origin master报错的解决方法 & 常见git命令(待更新) 参考Git常用命令 文章目录 git push origin master报错的解决方法 & ...

  2. git push origin master报错,解决方法

    今天,用git把本地代码推送到远程服务器上时出现错误: whl@whl-desktop:/work2/recvdsrc$ git push origin master klha@klha.net's ...

  3. git push origin master报错

    git push origin master报错error: src refspec xxx does not match any / error: failed to push some refs ...

  4. IDEA输入命令git push origin master报错: ! [remote rejected] master - master (hook declined)

    IDEA输入命令git push origin master报错: ! [remote rejected] master -> master (hook declined) error: fai ...

  5. git push origin master报错error: src refspec master does not match any || git commit报错nothing to commi

    git需要提交的文件夹内无内容修改导致 建议删除git初始化仓库生成的 .git 文件,然后将文件夹内容转移至其他路径,再次重新初始化提交. 或者, 将要提交的文件内容进行一定修改.

  6. 使用git checkout -b origin/命令报错is not a commit and a branch ‘dev_86984_newn‘ cannot be created from it

    使用git checkout -b origin/命令报错is not a commit and a branch 'dev_86984_newn' cannot be created from it ...

  7. Git Your branch is ahead of ‘origin/master‘ by X commits解决方法

    Git Your branch is ahead of 'origin/master' by X commits解决方法 参考文章: (1)Git Your branch is ahead of 'o ...

  8. idea项目提交到gitee以及出现提交出现的 Push rejected报错的解决方法

    在提交项目到Gitee的时候出现:Push rejected  弹窗错误提示上传失败的解决方法. 今天就跟大家聊聊有关idea提交项目到gitee时出现 Push rejected报错的解决方法,希望 ...

  9. 提交代码出现 Push to origin/master was rejected 错误解决方法

    提交代码出现 Push to origin/master was rejected 错误解决方法 参考文章: (1)提交代码出现 Push to origin/master was rejected ...

最新文章

  1. cocos2d-x游戏开发系列教程-坦克大战游戏之坦克的显示
  2. r型聚类典型指标_六种GAN评估指标的综合评估实验,迈向定量评估GAN的重要一步...
  3. 背包类树形DP 选课题解
  4. AdaBoost算法详解与python实现
  5. 缓存与数据库的一致性
  6. mfc 学习的第三天
  7. python是什么专业-python有什么用(会计专业)
  8. 5.企业安全建设指南(金融行业安全架构与技术实践) --- 安全团队建设
  9. python中33个保留字的含义_Python的保留字。这是什么意思?
  10. html5播放器视频抓取,分享10款最棒的免费HTML5视频播放器
  11. cs1.5最新服务器地址,CS1.5服务器地址,不定期更新
  12. 电脑连打印机不打印,是怎么回事?
  13. Android开发未来的出路何在,android学习路线图
  14. 对你影响最深的计算机书籍是哪一本?
  15. 有刷直流电机工作原理详解
  16. 【全网力荐】堪称最易学的Python基础入门教程
  17. 面试真题:经典智力题最详汇总
  18. 耳机检测--三段式和四段式耳机判别
  19. 利用VB.Net编程实现PC与掌上电脑PPC间的双向通信
  20. Cytoscape安装后无法打开

热门文章

  1. 计算机word2003操作试题,职称计算机word2003操作试题
  2. “张一鸣”为何突袭“王兴”
  3. 基于多时间尺度滚动优化的多能源微网双层调度模型 多能源微网 代码主要做的是一个多能源微网的优化调度问题,首先对于下层多能源微网模型多时间尺度 滚动优化 微网双层模型 调度
  4. 《魔道祖师》第三季预告片首发为汪叽庆生
  5. javascript 获取上级、同级和下级元素
  6. Powershell知识点1:开启脚本限制 报错:无法加载文件,因为在此系统中禁止执行脚本
  7. 批量修改图片名称(去掉原名字中的中文字符和空格)
  8. Verilog HDL 学习篇——六位数码管驱动
  9. YOLOv5/v8改进主干GhostNetV2系列:首发结合最新NIPS2022华为诺亚的GhostNetV2 架构:引入长距离注意力机制增强廉价操作,构建更强端侧轻量型骨干,打造高效轻量级检测器
  10. 将List集合按长度切分