[英]Why gitlab Storage is quite bigger than downloaded with git clone?
您已经执行了 GitLab 建议中的第一步。 以下步骤来自他们关于如何从 GitLab 存储中清除文件的文档。
这将是一个破坏性的行动。 您正在重写存储库历史记录。
从步骤 2 下载导出。
解压导出: tar xzf backup.tar.gz
这将包含一个由git bundle
创建的project.bundle
从包中克隆一个新的存储库副本: git clone --bar --mirror /path/to/project.bundle
使用之前安装的git filter-repo
,清除存储库历史记录中的所有文件。 GitLab 提供了几个示例命令。
To purge all large files, you will want to use `--strip-blobs-bigger-than`. This example reports files larger than 10 megabytes: `git filter-repo --strip-blobs-bigger-than 10M` To purge specific files by path, you can combine both `--path` and `--invert-path`: `git filter-repo --path path/to/large.mp4` --invert-paths
从克隆project.bundle
设置origin
远程到本地包文件。 这是不想要的,所以删除这个origin
remote 并将其重置到您的存储库。
git remote remove origin git remote add origin http://gitlab.example.com/<namespace>/<repository>.git
强制将更改推送到存储库。 这将覆盖所有分支。 如果您有受保护的分支,则需要先移除分支保护,运行以下命令,然后重新启用受保护的分支。
git push origin --force 'refs/heads/*'
如果您有大型标记版本,您还需要强制推送所有标记的更改。 如果您有受保护的标签,则需要先移除标签保护,运行以下命令,然后重新启用受保护的标签。
git push origin --force 'refs/tags/*'
防止已删除提交的死链接,运行以下命令:
git push origin --force 'refs/replace/*'
在您的存储库项目页面中,导航到Settings->Repository
上传由git filter-repo
命令创建的commit-map
。 GitLab 将此限制为每个文件 10M,但如果需要,您可以将其拆分并逐个上传。
点击Start Cleanup
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.