0

git 建议我将 git lfs 用于大文件。在我用 git lfs 跟踪它们并检查它们是否被添加到 .gitattribute 之后,我仍然收到相同文件大于 100MB 的错误。这里有什么建议以及如何解决这个问题?我还需要将这些大文件作为项目的一部分上传到 github。

    jalal@klein:~/computer_vision/py-faster-rcnn$ git push -u origin masterUsername for 'https://github.com': monajalal
    Password for 'https://monajalal@github.com': 
    Counting objects: 65949, done.
    Delta compression using up to 40 threads.
    Compressing objects: 100% (64616/64616), done.
    Writing objects: 100% (65949/65949), 1.53 GiB | 11.18 MiB/s, done.
    Total 65949 (delta 29371), reused 2 (delta 0)
    remote: Resolving deltas: 100% (29371/29371), done.
    remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
    remote: error: Trace: b3969bd24e3d0b92cab7299bbf735509
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/link-static/src/tr1/pch.hpp.gch is 127.21 MB; this exceeds GitHub's file size limit of 100.00 MB
    remote: error: File data/faster_rcnn_models/ZF_faster_rcnn_final.caffemodel is 226.19 MB; this exceeds GitHub's file size limit of 100.00 MB
    remote: error: File data/faster_rcnn_models.tgz is 694.81 MB; this exceeds GitHub's file size limit of 100.00 MB
    remote: error: File data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel is 522.92 MB; this exceeds GitHub's file size limit of 100.00 MB
    remote: error: File caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/src/tr1/pch.hpp.gch is 127.21 MB; this exceeds GitHub's file size limit of 100.00 MB
    To https://github.com/monajalal/faster_RCNN.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://github.com/monajalal/faster_RCNN.git'



jalal@klein:~/computer_vision/py-faster-rcnn$ ls
caffe-fast-rcnn  data  experiments  lib  LICENSE  models  README.md  test  tools
jalal@klein:~/computer_vision/py-faster-rcnn$ git lfs track "*.gch"
Tracking *.gch
jalal@klein:~/computer_vision/py-faster-rcnn$ git lfs track "*.tgz"
Tracking *.tgz
jalal@klein:~/computer_vision/py-faster-rcnn$ git lfs track "*.caffemodel"
Tracking *.caffemodel
jalal@klein:~/computer_vision/py-faster-rcnn$ git add -A
jalal@klein:~/computer_vision/py-faster-rcnn$ git commit -m "files larger than 100MB tracked with git lfs"
[master 
b60c05f] files larger than 100MB tracked with git lfs
 6 files changed, 3 insertions(+)
 create mode 100644 .gitattributes
 rewrite caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/link-static/src/tr1/pch.hpp.gch (99%)
 rewrite caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/src/tr1/pch.hpp.gch (99%)
 rewrite data/faster_rcnn_models.tgz (99%)
 rewrite data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel (99%)
 rewrite data/faster_rcnn_models/ZF_faster_rcnn_final.caffemodel (99%)
jalal@klein:~/computer_vision/py-faster-rcnn$ 
jalal@klein:~/computer_vision/py-faster-rcnn$ ls -a
.  ..  caffe-fast-rcnn  data  experiments  .git  .gitattributes  lib  LICENSE  models  README.md  test  tools


jalal@klein:~/computer_vision/py-faster-rcnn$ git push -u origin master
Username for 'https://github.com': monajalal
Password for 'https://monajalal@github.com': 
Username for 'https://github.com': monajalal
Password for 'https://monajalal@github.com': 
Git LFS: (5 of 5 files) 1.66 GB / 1.66 GB                                                                                                             
Counting objects: 65972, done.
Delta compression using up to 40 threads.
Compressing objects: 100% (64633/64633), done.
Writing objects: 100% (65972/65972), 1.53 GiB | 11.18 MiB/s, done.
Total 65972 (delta 29378), reused 2 (delta 0)
remote: Resolving deltas: 100% (29378/29378), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 4acfe1a1fdf5874edf9141fa8327428d
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/link-static/src/tr1/pch.hpp.gch is 127.21 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File data/faster_rcnn_models/ZF_faster_rcnn_final.caffemodel is 226.19 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File data/faster_rcnn_models.tgz is 694.81 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel is 522.92 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File caffe-fast-rcnn/boost_1_61_0/bin.v2/libs/math/build/gcc-5.2.1/release/src/tr1/pch.hpp.gch is 127.21 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/monajalal/faster_RCNN.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/monajalal/faster_RCNN.git'
jalal@klein:~/computer_vision/py-faster-rcnn$

里面.gitattribute的文件我有:

    *.gch filter=lfs diff=lfs merge=lfs -text
    *.tgz filter=lfs diff=lfs merge=lfs -text
    *.caffemodel filter=lfs diff=lfs merge=lfs -text
4

1 回答 1

1

您的历史记录仍然包含大文件,您需要重写以删除这些文件。

git bfg是一个工具(用 java 编写),可以轻松地从历史记录中删除较大的文件。

仅使用内置工具,您可以使用 git filter-branch with--tree-filter删除文件(示例应该在文档中)。

警告

请注意,像 BFG 和git filter-branch重写历史这样的工具。如果您重写已推送的提交,这可能会影响在这些提交上构建的其他人。小心使用。

于 2016-08-31T20:47:34.453 回答