git正试图上传已经手动删除的文件

时间:2016-10-01 08:25:16

标签: git github

我在旧的提交中添加了一个文件而没有推送该提交,然后我从dir中删除了该文件。之后我做了更多更改并添加了更多提交,现在每当我尝试推送代码时,我都会遇到此错误git push -u origin master

Counting objects: 58, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (58/58), done.
Writing objects: 100% (58/58), 197.83 MiB | 370.46 MiB/s, done.
Total 58 (delta 44), reused 0 (delta 0)
remote: Resolving deltas: 100% (44/44), completed with 10 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 7db8d77e8595ae0da9cc34aa2ab1c4d0
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File public/uploads.zip is 197.85 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/repo-name
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/repo-name'

手动删除了提及uploads.zip的文件。所以这个文件在目录中不存在。

当我git log origin/master..master时,我甚至不会在列表中看到该文件。

以下是git status link

的结果

1 个答案:

答案 0 :(得分:1)

如果您的git repo一直试图上传大文件,您可能需要并检查是否有任何跟踪(以及后来删除的)大文件。

使用BFG Repo cleaner并查看您的历史记录中是否没有要删除的文件。

  

删除大于10兆字节的所有blob:

$ bfg --strip-blobs-bigger-than 10M  my-repo.git 

# or

java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git