分享免费的编程资源和教程

网站首页 > 技术教程 正文

解决GitLab报错:not allowed to force push code to a protected branch

goqiw 2025-08-03 04:47:06 技术教程 6 ℃ 0 评论

当 force push 代码的时候,可能会遇到如下错误:

You are not allowed to force push code to a protected branch on this project

主要原因是因为向一个受保护的分支强制提交了代码,可以在仓库里面进行设置来解决这个问题。

如下图所示:

更详细的信息可以看 stackoverflow 上的解释。

并且,针对不同的 GitLab 版本,都进行了如何配置的说明。


stackoverflow 地址:

  • https://stackoverflow.com/questions/32246503/fix-gitlab-error-you-are-not-allowed-to-push-code-to-protected-branches-on-thi

热情推荐:

  • https://github.com/yongxinz/tech-blog: 硬核后端技术干货,内容包括 Python、Django、Docker、Go、Redis、ElasticSearch、Kafka、Linux 等。
  • https://github.com/yongxinz/gopher: Go 学习路线图,包括基础专栏,进阶专栏,源码阅读,实战开发,面试刷题,必读书单等一系列资源。
  • https://github.com/yongxinz/backend-interview: 包括 Python、Go、Redis、MySQL、Kafka、数据结构、算法、编程、网络等各种常考题。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表