2016-02-05 27 views
2

我想我的项目推到github上,并收到以下错误文件:Git的努力推动未进行跟踪

Counting objects: 87, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (78/78), done. 
Writing objects: 100% (87/87), 50.25 MiB | 1.14 MiB/s, done. 
Total 87 (delta 32), reused 0 (delta 0) 
remote: warning: File example-attractor/bin/example-attractor_debug.ilk is 51.19 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB 
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. 
remote: error: Trace: f711bd940689c3c64a38c283877b86f8 
remote: error: See http://git.io/iEPt8g for more information. 
remote: error: File example-attractor/example-attractor.sdf is 103.62 MB; this exceeds GitHub's file size limit of 100.00 MB 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs 

好了,没什么大不了的。我加了*.sdf*.ilk.gitignore,删除,并添加我的所有文件,并通过检查git ls-files我跟踪文件:

.gitignore 
example-attractor/README.md 
example-attractor/addons.make 
example-attractor/example-attractor.sln 
example-attractor/example-attractor.vcxproj 
example-attractor/example-attractor.vcxproj.filters 
example-attractor/icon.rc 
example-attractor/src/main.cpp 
example-attractor/src/ofApp.cpp 
example-attractor/src/ofApp.h 

太好了!这些文件已从跟踪中删除。我试图再次推送到Github,并得到了同样的错误。我跑git status并没有改变:

On branch master 
Your branch is ahead of 'origin/master' by 3 commits. 
    (use "git push" to publish your local commits) 
nothing to commit, working directory clean 

我困惑,现在怎么办!为什么git仍然试图推送未被追踪的文件?

+0

可能的重复[如何在我的分支由5个提交超前主提交时删除提交中的一个太大的文件](http://stackoverflow.com/questions/20002557/how-to-remove-a-too -large-file-in-a-commit-when-my-branch-is-ahead-of-master-by) – Powerlord

+0

不幸的是,没有解决方案解决了我的问题:( –

回答

3

最可能的解释是您在前3次提交之一中提交了该文件。你需要做的是从它们中删除它。通过做git rebase -i origin/master来做到这一点。这将带来一个包含所有这些提交的编辑器。将所有三个提交的“pick”替换为“e”,保存并关闭编辑器。每次提交后,Git都会暂停,此时您可以从索引中删除文件,请执行git commit --amend,然后git rebase --continue。那你应该没问题。

1

Great! The files have been removed from tracking.

从未来的追踪,是的。但是您仍然在您当地的分支机构历史记录master中有提交。

Why is git still trying to push files that aren't tracked?

当你推送一个分支时,它的所有祖先提交还没有在远程被推送到那里。

I'm perplexed as to what to do now!

从分支的历史记录中删除不需要的文件,无论是like David suggestsgit rebase -i origin/master而在master分支,或with git filter-branch。无论哪种情况,请在更改任何历史记录之前备份您的存储库。