[经验总结]删除gitlab仓库分支报错:错误:无法推送一些引用到“http:”

问题描述

删除gitlab远程仓库报错。

shell 复制代码
[wingaso@wingaso release]$ git push gitlab --delete release
remote: GitLab: You can only delete protected branches using the web interface.
To http://x.x.x.x/gitlab/test.git
 ! [remote rejected]     release (pre-receive hook declined)
错误:无法推送一些引用到 'http://x.x.x.x/gitlab/test.git'

问题分析

根据第一句话,"You can only delete protected branches using the web interface."(你仅能使用web端删除受保护分支),因此我们可以初步判断问题出在分支收到保护限制。

取消保护限制

进入gitlab页面端,依次点击:设置->仓库->受保护分支->取消保护 。如下图所示。

注:根据实际测试,允许强制推送 按钮激活后,只能允许命令push -uf gitlab master(即强推)的执行,但仍不能对该分支进行删除。需要彻底将对应分支取消受保护后,才能删除成功。

再次尝试删除

如下图所示,显示删除成功。

shell 复制代码
[wingaso@wingaso release]$ git push gitlab --delete release
 - [deleted]             release
相关推荐
chlk12313 小时前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑13 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件14 小时前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号1 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash1 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI2 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
vibecoding日记2 天前
为什么我就想要「线性历史 + Signed Commits」,GitHub 却把我当猴耍 🤬🎙️
git·编程工具
十日十行2 天前
Linux和window共享文件夹
linux
木心月转码ing3 天前
WSL+Cpp开发环境配置
linux