[经验总结]删除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
相关推荐
GottdesKrieges几秒前
OceanBase备份常见问题
linux·网络·oceanbase
白菜欣15 分钟前
Linux —进程概念
linux·运维·服务器
iuu_star18 分钟前
Vue+FastAPI 项目宝塔Linux部署指南
linux·运维·fastapi
楼田莉子21 分钟前
仿Muduo的高并发服务器:Channel模块与Poller模块
linux·服务器·c++·学习·设计模式
zhouwy11322 分钟前
Linux网络编程从入门到精通
linux·c++
zhangrelay26 分钟前
ROS Kinetic-信号与系统-趣味案例
linux·笔记·学习·ubuntu
IMPYLH27 分钟前
Linux 的 tail 命令
linux·运维·服务器·bash
weixin_4462608528 分钟前
应用实战篇:利用 DeepSeek V4 构建生产级 AI 应用的全流程与最佳实践
大数据·linux·人工智能
Nightwish541 分钟前
Linux随记(三十)
linux·运维·mysql·ambari
cui_ruicheng1 小时前
Linux信号机制(一):从概念到产生与处理
linux·运维·服务器