Git-LFS错误:通过上传大文件

时间:2016-01-14 01:41:41

标签: git git-lfs

我安装了Git-LFS,如果你查看下面的日志,你可以看到Git-LFS正在跟踪我尝试上传的所有文件,但仍然给我的文件大于限制错误。那么问题是什么?

C:\***\Immortal-Dawn [Programming +0 ~1 -0 | +126 ~4 -0 !]> git push origin Programming
Counting objects: 152, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (109/109), done.
Writing objects: 100% (152/152), 357.06 MiB | 727.00 KiB/s, done.
Total 152 (delta 85), reused 80 (delta 21)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: c8d3b4fb7b9d8e6bdb74d5af30a9f9ee
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File ImmortalDawn.sdf is 311.94 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File Plugins/NPC Plugin/Intermediate/Build/Win64/UE4Editor/Development/NPCPluginCore/NPCPluginCorePCH.h.pch is 149.50 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File Plugins/Test/Intermediate/Build/Win64/UE4Editor/Development/Test/TestPrivatePCH.h.pch is 354.06 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File Intermediate/Build/Win64/UE4Editor/Development/ImmortalDawn/ImmortalDawn.h.pch is 698.56 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://***/Immortal-Dawn.git
 ! [remote rejected] Programming -> Programming (pre-receive hook declined)
error: failed to push some refs to 'https://***/Immortal-Dawn.git'

C:\***\Immortal-Dawn [Programming +0 ~1 -0 | +126 ~4 -0 !]> git lfs track
Listing tracked paths
    *.pch (.gitattributes)
    *.sdf (.gitattributes)
    *.sdf,*.pch (.gitattributes)
    *.psd (.gitattributes)
    ImmortalDawn.sdf (.gitattributes)

2 个答案:

答案 0 :(得分:0)

对我而言,文件似乎没有上传到lfs位置。如果将文件推送到正确的lfs存储,则输出如下:

LFS: 12.58 MB / 12.58 MB  100.00 %

在我看来,你应该检查你的存储库中的.gitconfig文件。应该添加这样一行:

[lfs "http://User@localhost:7990/scm/plt/reponame.git/info/lfs"]
access = basic

GitHub上的网址可能会有所不同。您还应该检查您的存储库(服务器端)是否启用了LFS。

答案 1 :(得分:0)

我有一个类似的问题,其中我使用git lfs track向git-lfs添加了一些超出大小限制的文件,但是仍然拒绝推送。与您的输出的不同之处在于,我得到一行提示(例如):

Uploading LFS objects: 100% (88/88), 251 MB | 1.2 MB/s, done.

之前

remote: error: GH001: Large files detected.

当我git lfs track检查要排除的内容时,我得到:

❯ git lfs track
Listing tracked patterns
    *.csv (.gitattributes)
Listing excluded patterns

与您的输出稍有不同(您说Listing tracked paths,而我说Listing tracked patterns),因此您的git-lfs版本可能不同。

关于为何仍拒绝推送的原因,根据以下问题:Failing to push large files · Issue #1933 · git-lfs/git-lfs,您必须先将文件添加到git-lfs ,然后再将其添加到仓库

您可以按照该线程中的描述手动重写历史记录,也可以使用BFG Repo-Cleaner 自动重写历史记录(我还没有尝试过...)。

编辑:显然,您可以使用git lfs migrate import将文件添加到回购中已经存在的lfs中,而无需重写历史记录:Migrating existing repository data to LFS。另请参见以下SO线程:git lfs - What does git lfs migrate do?