首页 > 其他分享 >git push时报错"error: failed to push some refs to"

git push时报错"error: failed to push some refs to"

时间:2022-09-06 09:14:06浏览次数:113  
标签:origin git refs master push main 远程

在本地分支master需要强制上传并覆盖到远程仓库的main分支上时,出现了如下错误:

执行以下任意一个操作,均报错error: failed to push some refs to

  • git push -u origin main

  • git push -u origin main -f

  • git push origin main --force

使用命令 git push origin master:main -fgit push origin [master本地分支名]:[main远程分支名] -f)可成功覆盖远程内容,但是不清楚具体原因。

排除了以下原因:

  1. 远程并不存在未和本地同步的文件,包括 README.md,所以使用 git pull + rebase 无效

  2. 远程仓库分支 main 和本地指定仓库名 master 均无错误

有知道的大佬可以留下言~ 感谢~

标签:origin,git,refs,master,push,main,远程
From: https://www.cnblogs.com/huangkenicole/p/16660445.html

相关文章

  • 强制推送本地分支覆盖远程失败git push origin master --force报错fatal: Authenticat
    当我想把本地分支强制性推到远程的master分支,执行gitpushoriginmaster--force命令时,报错如下:解决办法:重新配置用户名和邮箱gitconfig--globaluser.name"用户......
  • git上传项目完整步骤
    具体步骤gitconfig--globaluser.nameytgitconfig--globaluser.name2214100039@qq.comgitinitgitremoteaddoriginhttps://gitee.com/ytao99/data-structu......
  • git lfs error:batch response: HTTP/2 cannot be used except with TLS
    自己在腾讯云通过gitea架设的git服务器,使用了lfs。commit和push都很正常,不过换了台机器clone时遇到问题:gitlfspullbatchresponse:HTTP/2cannotbeusedexceptwi......
  • Sourcetree 如何关联自己的gitlab仓库
    现在有些企业自己搭建了gitlab服务器,通过sourcetree从企业服务器拉取代码的时候会提示认证失败。今天搞了大半天才搞懂,给我自己做个笔记。添加账户托管服务商选择G......
  • git的用法
    远程仓库是与本地仓库是通过origin来进行交互的,所以本地的分支只有关联origin才能与远程仓库交互master是自动关联origin的,但是其他的分支就要自己手动关联了那么origin是......
  • [AWS] CloudFormation Template Connect Github Version 2 Using CodeStar
    UsingCloudFormationtemplatetocreateCodePipelineshouldbethebestpracticetomaintainapipeline.Therearealotofpostsorvideosonlinethatcante......
  • MLops:我最喜欢的数据科学项目的 Github 项目模板
    MLops:我最喜欢的数据科学项目的Github项目模板source:unsplash.com-@yancyminTLDR:在这个故事中,我将分享一个git项目结构,我经常将其用作数据科学项目的起点,并......
  • git提交到项目中自动部署
    git提交到项目中自动部署git提交到项目中自动部署2021-11-1016:30:03设置webhock地址webhock触发命令#!/bin/shcd/www/wwwrootoutput=`gitreset--ha......
  • Git
    什么是Gitgit是一种版本同步工具;实际项目开发中,涉及到多人的团队性质的协同开发;Git的三种状态现在请注意,如果你希望后面的学习更顺利,请记住下面这些关于Git的概念。G......
  • Git使用
    git命令的使用#配置git用户信息$gitconfig--globaluser.name"用户名"[email protected]$gitinit #将当前目录作为工作区,生成.......