2015-12-01 60 views
0

我使用JMeter的执行一些负载测试,然后试图通过做Git的大文件检测

git add . 
git commit -m "message" 
git push 

到我的项目签入混帐我得到一个错误信息

Counting objects: 13, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (13/13), done. 
Writing objects: 100% (13/13), 50.13 MiB | 13.42 MiB/s, done. 
Total 13 (delta 8), reused 0 (delta 0) 
remote: error: GH001: Large files detected. 
remote: error: File java_pid32554.hprof is 412.89 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB 
To https://github.dev.myc.com/p/p.git 
! [remote rejected] feature/branch -> feature/branch (pre-receive hook declined) 
error: failed to push some refs to 'https://github.dev.myc.com/p/p.git' 

要解决错误我做了以下

git rm java_pid32554.hprof 
rm java_pid32554.hprof 
added */*.hprof to .gitignore 
现在

我可以看到,有问题的文件是从本地文件系统中删除。可以肯定我也做了搜索

MacBook-Pro:p (feature/branch>)$ sudo find/-name java_pid32554.hprof 
Password: 
find: /dev/fd/3: Not a directory 
find: /dev/fd/4: Not a directory 
MacBook-Pro:p (feature/branch>)$ 

所以文件确实没了。

现在,当我尝试

混帐推

再次给出了相同的错误消息....即使文件被删除。

我不会庆祝这个问题进行this

重复我的问题从混帐介绍了直接的错误信息和下面的答案更加明确和直接。另一个线程混杂着不同类型的解决方案。

+0

可能的重复[如何从Git存储库中的提交历史中删除/删除大文件?](http://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-从提交历史功能于混帐资料库) –

回答

0

这第一种方法假定您不关心“跟踪”的大文件;因此不关心在GitHub上保留它的副本。在这种情况下,您需要“回到原点”以前的提交;在添加大型违规文件之前进行提交。

您可以执行以下操作来做到这一点:

git tag too_big   # a "savepoint" just in case you care for it later 
git log     # find an earlier COMMIT_ID 
git reset --hard COMMIT_ID # replace COMMIT_ID with the one found 

# See how things are at this point 
git status 

如果是“混帐地位”后不干净,也许你会感兴趣的:

# Optionally, this will wipe things out 
git clean -df 

然后继续你的工作从那一点。

git push master  # assuming your branch is master 

如果您需要恢复该巨型文件,该标记将为您提供一个参考点。当您尝试推送到GitHub时,它也会导致问题,因此只推送master而不是通用(含糊)git push(可能暗示--all)。


另外,如果必须应用“源代码控制”到非常大的文件由于某些原因,你可以探索GitHub的LFS(大文件存储)的git扩展。

https://git-lfs.github.com/

这可能是明智的,有用于处理大型文件的混帐子仓库(正式名称为子模块)。

https://git-scm.com/book/en/v2/Git-Tools-Submodules

1

这是因为你的本地Git有大文件的历史记录。在git中,历史记录包含完整文件,即使它已被删除的最新版本,这是为了您可以撤消更改。为了解决这个问题,你需要重写历史记录,或者将git repo恢复到以前的版本。

请参阅相关链接:How to revert Git repository to a previous commit?

0

我面对这个问题,并没有想恢复到以前的版本。我选择的选项是将资源库复制到别处,再次克隆,然后用原始文件(大文件除外)覆盖文件。