目前启智AI协作平台对代码仓大小控制策略如下:
值得特别说明的是,数据集文件请在数据集tab下上传,不要上传到代码仓中!
当代码仓容量超过限制后,针对该代码仓的push都将会失败,此时可通过删除仓库内大文件来实现。
查看git历史中大文件命令:
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')"
如果文件使用最近的提交添加,而您尚未推送到 服务端,您可以删除文件并修改提交:
打开 Git Bash。
将当前工作目录更改为您的本地仓库。
要删除文件,请输入git rm --cached
:
$ git rm --cached giant_file
使用--amend -CHEAD
提交此更改:
$ git commit --amend -CHEAD
将提交推送到服务端
$ git push
警告:这些步骤将从您的计算机和服务端上的仓库中永久删除文件。 如果文件很重要,请在仓库外部的目录中创建本地备份副本。
Git有原生命令git filter-branch
来处理提交历史中的数据,但在实际使用过程中许多用户发现这个命令耗时很长且效果不佳,因此推荐使用下面两种方式。
git filter-repo
是一个用于重写Git历史的开源项目,以下是简单的使用步骤说明,更多的使用说明请前往git filter-repo查看
安装最新版本的工具。您可以git-filter-repo
手动安装或使用包管理器安装。例如,在windows下使用pip安装该工具,可使用如下命令
pip install git-filter-repo
将待处理的仓库clone到本地并进入仓库目录。
运行以下命令,开始在历史中删除大文件
$ git filter-repo --invert-paths --path PATH-TO-YOUR-GIANT_file
检查是否已成功清除
确定清除成功没有其他问题后,强制推送到服务端。
$ git push origin --force --all
BFG Repo-Cleaner是一个由开源社区构建和维护的工具。它为删除不需要的数据提供了一种更快、更简单的替代方法。
例如,要删除大文件并保持最新提交不变,请运行:
$ bfg --delete-files YOUR-GIANT-FILE
要替换big.txt
在存储库历史记录中可以找到的所有文本,请运行:
$ bfg --replace-text big.txt
删除大文件后,必须强制将更改推送到服务端。强制推送会重写存储库历史记录,从而从提交历史记录中删除大文件。
$ git push --force
有关完整使用和下载说明,请参阅BFG Repo-Cleaner的文档。
在使用git filter-repo
或 BFG 工具删除大文件并将更改推送到服务端后,请告知所有协作者,push 代码前需要 pull rebase,而不是 merge,否则大文件可能会从该协作者的本地仓库再次引入到远程库中。
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》