gitlab中的repo删除特定commit

最近代码提交的时候发现一个问题

我有一些缓存代码,推送到gitlab上,分支已经push-f 了,但是其他用户还是可以通过commitid来访问代码。然后我尝试了:

  1. 通过 Web 界面(需要 Maintainer 权限)

    Settings → General Settings → Advanced → Run housekeeping

  2. 本地GIT操作

sh 复制代码
# 安装 git-filter-repo
pip3 install git-filter-repo

# 从历史中删除特定文件
git filter-repo --path <file-path> --invert-paths

# 或删除包含敏感信息的 commit
git filter-repo --commit-callback '
  if commit.original_id in [b"<commit-id-1>", b"<commit-id-2>"]:
    commit.skip()
'

# 强制推送所有分支
git push origin --force --all
git push origin --force --tags

发现都没有生效,特别是Web 界面,操作2次之后,会提示

Somebody already triggered housekeeping for this resource in the past 1440 minutes

看起来原因是:

  • housekeeping 是资源密集型操作(CPU、磁盘 I/O)
  • 频繁执行可能影响 GitLab 服务器性能
  • 防止误操作或恶意行为

默认限制:

  • 手动触发间隔: 24 小时
  • 自动触发周期: 每 1000 次推送

我等了差不多1天,但是发现代码还是可以访问,最后是删除了repo,重新创建并上传

复制代码
Settings → General Settings → Advanced → Delete this project
相关推荐
IT大白鼠7 天前
GitLab 未认证 RCE 应急实战CVE-2026-97229(CVSS 10.0)
网络·安全·gitlab
71777713 天前
Git自建用什么工具比较好:Gitea、Forgejo、GitLab CE与Gitee的选型对比
git·gitlab·gitea
colinu15 天前
Create gitlab-runner
gitlab
master33616 天前
GitLab 10.x → 19.5.x 升级路线图
gitlab
长不大的杨瑞杰16 天前
OpenCode v2 GitLab 集成实战:Issue 驱动开发、MR 审查与 CI/CD 最小权限
人工智能·ci/cd·gitlab·ai编程·opencode
极小狐22 天前
极狐GitLab万人并发架构实践,大规模组织的扩容路线图
架构·gitlab·极狐gitlab
Lvan的前端笔记23 天前
GitLab CI 环境变量整理
ci/cd·gitlab
李迟24 天前
CICD实例:解决GitLab Runner无法执行CICD问题
gitlab
hanjq_code1 个月前
gitlab本地文件 跨分支 忽略改动 不提交
gitlab
极小狐1 个月前
极狐GitLab集群高可用方案,多节点架构与故障自愈实践
架构·gitlab·高可用·极狐gitlab