出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题

简介: 出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题

一、出错情况:

今天继续推送整理的知识点的时候,出现了一个报错。“error: failed to push some refs to 'https://github.com/.git'”,百思不得其解,之前推送的时候都可以轻松推送成功,如今却说本地库与远程库不一致。


二、出错原因:

经过不断查看别人的博客,分析问题:发现本地库确实与远程库内容不相符合。昨天在演示如何删除远程库中的文件时,采用的是直接在github仓库中,手动删除。因此本地库还未更新删除的操作,因此需要先“pull”使本地库与远程库内容一致,才可以继续推送。【强烈建议!!!大家在推送文件时,记得先pull再push,养成好习惯。】



三、解决方法:

1.此时的main或者master要看你当前分支!!!若出现以下信息,即可操作步骤二,否则请检查是否是其他原因。

git pull --rebase origin main


2.如期出现以上信息,继续输入如下指令即可【此处一样main或master看自己的分支】出现以下信息,证明推送成功!

git push origin main

相关文章
verbose stack FetchError: request to https://registry.npm.taobao.org/md-editor-v3 failed, reason: ce
这篇文章描述了在安装npm包`md-editor-v3`时遇到的淘宝镜像证书过期问题,并提供了解决方案,即通过切换npm镜像源到`https://registry.npmmirror.com/`来解决安装失败的问题。
verbose stack FetchError: request to https://registry.npm.taobao.org/md-editor-v3 failed, reason: ce
|
9天前
|
开发工具 git
GIT:如何合并已commit的信息并进行push操作
通过上述步骤,您可以有效地合并已提交的信息,并保持项目的提交历史整洁。记得在执行这些操作之前备份当前工作状态,以防万一。这样的做法不仅有助于项目维护,也能提升团队协作的效率。
17 4
|
10天前
|
开发工具 git
GIT:如何合并已commit的信息并进行push操作
通过上述步骤,您可以有效地合并已提交的信息,并保持项目的提交历史整洁。记得在执行这些操作之前备份当前工作状态,以防万一。这样的做法不仅有助于项目维护,也能提升团队协作的效率。
57 3
|
2月前
|
Java Spring
成功解决Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings
这篇文章提供了解决Spring Initializr网站初始化失败问题的方法,包括检查URL、网络和代理设置。
成功解决Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings
|
6天前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
6天前
|
测试技术 API
8-20|https://gitlab.xx.com/api/v4/projects/4/trigger/pipeline Request failed 状态码400
8-20|https://gitlab.xx.com/api/v4/projects/4/trigger/pipeline Request failed 状态码400
|
2月前
|
JavaScript
request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired
request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired
52 2
|
2月前
|
开发工具 git 开发者
|
2月前
|
网络安全 开发工具 数据安全/隐私保护
Win10使用Git克隆项目出现fatal: Authentication failed for异常
Windows 10系统中使用Git克隆项目时出现"fatal: Authentication failed for"异常的解决方法,主要是通过修改凭据管理器中的Git凭据密码来解决因密码过期导致的身份验证失败问题。
38 0
Win10使用Git克隆项目出现fatal: Authentication failed for异常
|
2月前
|
Ubuntu 开发工具 git
ubuntu 14.04的git 错误: gnutls_handshake() failed: Handshake failed
本文提供了一个解决Ubuntu 14.04系统上使用Git时遇到的"gnutls_handshake() failed: Handshake failed"错误的脚本,通过替换git的默认加密传输库gnutls为更稳定的openssl,并指导如何编译安装新版本的git来解决问题。
19 0
下一篇
无影云桌面