如何导入带有大文件的git存储库?
有鉴于此,不可能将包含大型文件的存储库存储到GitHub enterprise中。推送失败,原因是:如何导入带有大文件的git存储库?,git,github,git-lfs,github-enterprise,bfg-repo-cleaner,Git,Github,Git Lfs,Github Enterprise,Bfg Repo Cleaner,有鉴于此,不可能将包含大型文件的存储库存储到GitHub enterprise中。推送失败,原因是: remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: File large.zip is 145.00 MB; this exceeds GitHub Enterprise's file
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: File large.zip is 145.00 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB
(注意:有,但这仅适用于github.com,需要对您的存储库进行公共访问)
幸运的是,自2015年4月以来,GitHub一直处于领先地位。那么,如何将包含如此大文件的当前存储库转换为我可以推送到的GitHub LFS兼容存储库?我发现的最简单的方法是利用和(我使用的是版本
1.12.12
):
$git克隆--镜像git@oldgithost:回购
$cd repo.git
#镜像到本地目录
$git filter branch--tree filter'git lfs track'*.{zip,jar}'--all
#将lsf轨迹中的模式写入.gittributes
$java-jar~/usr/bfg-repo-cleaner/bfg-1.12.12.jar——转换为git-lfs'*.zip'
$java-jar~/usr/bfg-repo-cleaner/bfg-1.12.12.jar——转换为git-lfs'*.jar'
#转换大文件(我找不到适用于多个模式的一行程序)
$git推送--镜像https://hostname/ghuser/repo.git
#将镜像推送到新的GitHub企业存储库
$cd。。
$rm-rf repo.git
笔记
1由于I/O较高,需要使用-d选项将历史记录重写到磁盘外的临时目录中,例如在tmpfs上。您现在可以使用
git lfs migrate
内置命令来评估哪些文件最适合迁移,也可以执行实际的历史记录重写
有关更多详细信息,请参阅。您可以增加该限制,但应谨慎操作。目前我没有时间测试该限制,但现在看来确实是应该做的。在证明错误之前,我会将公认的回答改为这个。谢谢