远程服务器中的大文件库存我无法推送我无法删除它

时间:2016-04-24 22:18:41

标签: git git-rewrite-history

我不是git的新手,但我必须说我没有先进的用户体验,我确实添加了一个文件(mp4)而没有检查大小导致真的很大,现在因为一些奇怪的原因git没有告诉我提交,但在下一次提交,然后我在本地删除文件(手动将其从视频文件夹中删除,并尝试再次使用已删除的文件提交。然后跳转尝试任何可能导致更多提交的任何情况的解决方案! !现在我收到这些消息,文件仍然在故事的某个地方,但我找不到它,我无法重新开始,我不能失去工作。

您的分支机构领先于原创/开发'由5个提交。   (使用" git push"发布您的本地提交) 无需提交,工作目录清理

然后我推和:

Counting objects: 73, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (72/72), done.
Writing objects: 100% (73/73), 718.63 MiB | 897.00 KiB/s, done.
Total 73 (delta 57), reused 1 (delta 0)
remote: error: GH001: Large files detected. 
remote: error: Trace: f010797db7ebbdf07ec4779755dc18f9
remote: error: See url for more information.
remote: error: File web/videos/modepalastried.mp4 is 719.64 MB; this exceeds GitHub's file size limit of 100.00 MB to repo

[remote rejected] develop -> develop (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Myuser/repo.git'

我可以尝试删除尚未推送的所有提交但我真的做了很多我不想丢失的工作。我尝试重置--soft但它没有用。我查找了特定版本并检查文件是否存在但是说:文件不存在。请帮忙

谢谢你< 3

2 个答案:

答案 0 :(得分:2)

BFG可能是根据您的需求量身定制的 - 在您的情况下,您可能希望使用以下命令运行它:

$ java -jar bfg.jar --delete-files modepalastried.mp4  my-repo.git

这将删除最近一次提交中不是的所有名为modepalastried.mp4的文件。

完全披露:我是BFG Repo-Cleaner的作者。

答案 1 :(得分:0)

<强> How to remove big files from the repository

您可以使用git filter-branch或BFG。 https://rtyley.github.io/bfg-repo-cleaner/

  

<强> BFG Repo-Cleaner

     

git-filter-branch的替代品。

     

BFG是git-filter-branch的一种更简单,更快速的替代方法,用于清除Git存储库历史记录中的错误数据

     

*删除疯狂的大文件*
  *删除密码,凭证和&amp;其他私人数据

示例(来自官方网站)

  

在所有这些示例中,bfg是java -jar bfg.jar的别名。

# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa}  my-repo.git