大文件卡在git commit中

时间:2016-04-04 23:37:01

标签: git github

remote: error: GH001: Large files detected. You may want to try Git Large File Storage

我删除了该文件。下面,您可以看到我尝试推送,然后尝试从缓存中删除该文件。

enter image description here

如何摆脱这个大文件,以便再次推送?

3 个答案:

答案 0 :(得分:2)

我最终做了一个解决方法。

  1. 将我的所有文件备份到另一个文件夹:cp . ../backup
  2. 从备份中移除.git:rm -R ..backup/.git
  3. 在服务器上找到最新的好提交并恢复到它:git reset --hard c14809fa
  4. 复制所有旧文件:cp ../backup .
  5. 然后继续前进并提交并推送。

答案 1 :(得分:2)

不得仅删除该文件,必须将其从历史记录中删除。这与远程敏感文件(例如密码文件)所遵循的程序相同。

有很多方法可以做到这一点,最简单的方法是follow the instructions on Github。它们显示了两种方法,可以从存在的所有提交中清除文件。

答案 2 :(得分:0)

对我有用的一个好的解决方案:

git filter-branch --tree-filter 'rm path/to/your/bigfile' HEAD

然后:

git push origin master --force
相关问题