gpt4 book ai didi

Git 尝试推送未跟踪的文件

转载 作者:太空狗 更新时间:2023-10-29 14:37:13 25 4
gpt4 key购买 nike

我尝试将我的项目推送到github,并收到以下错误:

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-文件:

.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 仍在尝试推送未跟踪的文件?

最佳答案

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

关于Git 尝试推送未跟踪的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35234420/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com