[经验总结]删除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
相关推荐
我叫黑大帅8 小时前
git 的 NFD 与 NFC 有什么区别?为什么我有个文件在 NFC 中间不会被当成改动,在 NFD 中就会当成改动
git·面试·github
寒水馨9 小时前
Linux下载、安装llama.cpp-b10068(附安装包llama-b10068-bin-ubuntu-vulkan-x64.tar.gz)
linux·ubuntu·llm·llama·本地部署·llama.cpp·推理引擎
呆萌很11 小时前
Git push 408 超时、远程断开解决办法
git
ziguo112212 小时前
C/C++ 错误处理全解:从 errno 到 C++ 异常
linux·c语言·c++·windows·visual studio
Lesile12 小时前
Hands-on Git experience
git
三84413 小时前
使用Samba/NFS实现文件共享/自动挂载共享目录/autofs自动挂载服务
linux·服务器·网络
高铭杰13 小时前
万物皆可KV(2)SurrealDB 存储布局分析
linux·服务器
Co_Hui13 小时前
Git 基本使用
git
cooldream200914 小时前
AI 时代,Git 应该怎么学
人工智能·git
无小道14 小时前
深入解析操作系统文件缓冲区:页缓存、基数树与f_pos的协同设计
linux·缓存·文件缓冲区