gitlab - 将 BFG 的结果存储到 Gitlab 中的新项目中
问题描述
我已经成功(我认为!)从使用 BFG 镜像到我的本地驱动器上的 gitlab 项目中删除了大文件。我不想替换现有的 gitlab 项目(出于安全原因),而是想推到一个新的测试 gitlab 项目。这是我到目前为止成功完成的命令:
git clone --mirror git@git.domain.com:architecture-team/IOMobile.git
java -jar bfg.jar --strip-blobs-bigger-than 100M IOMobile.git/
cd IOMobile.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive
这些命令似乎已经成功了,现在我如何将原点重置为:
git@git.domain.com:architecture-team/testiomobile.git
...然后将镜像推入新项目?我不确定如何在镜像上重置原点,并想确保我不会更改原始项目。
我只是做一个简单的
git push
还是我需要
git push --mirror
感谢您的帮助-欧文
解决方案
我认为在这种情况下,您是否指定--mirror
都没关系。由于您已经使用--mirror
标志克隆了它,因此普通的 git push 将更新远程服务器上的所有引用。这也在 bfg 文档中有所描述: https ://rtyley.github.io/bfg-repo-cleaner/
但是你可能会遇到一个问题。如果您在推送时看到此错误消息:
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
然后您必须在 URL https://git.domain.com/architecture-team/testiomobile/-/settings/repositoryAllow force push
的 GitLab 项目设置中启用选项
推送后,您应该Allow force push
再次禁用。
推荐阅读
- git - git错误:RPC失败;HTTP 502 curl 22 The requested URL returned error: 502 fatal: 远端意外挂断
- python - 为什么我的终端不允许使用 pip?但允许 pip3
- c++ - 运算符重载 += 添加新对象
- python - 使用 BaseEstimator、TransformerMixin 自定义 Transformer
- javascript - 在交易视图订单上使用 javascript 更改价格值的想法
- kubernetes - 如何在公有云中获取 LBaaS 的公有 IP?
- java - 在 Java 中避免泛型的冗余参数
- jinja2 - 编写sql时如何在python jinja2中使用基本模板中的{%extends%}
- django - 表单未保存到用户模型 Django
- c# - 具有新 sdk 样式 csproj 的附加 nuget 依赖项