Git仍然试图推送被忽略和删除的文件 [英] Git still trying to push ignored and deleted file

查看:202
本文介绍了Git仍然试图推送被忽略和删除的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的 .framework 文件,由于某种原因,Git LFS无法正常工作,所以我决定忽略它,因此它不是推。


  1. 我将它添加到我的 .gitignore 中。$ b $我从终端

      git rm -r --cached运行了这3个命令。 
    git add。
    git commit -mfixed untracked files


  2. code> .framework 不再被跟踪。

  3. 当我尝试再次推送提交时,我仍然得到文件太大的错误。

      remote:错误:GH001:检测到大文件。你可能想尝试Git Large 
    文件存储 - https://git-lfs.github.com。
    remote:error:跟踪:6b97634aa8b5de75e8affdcb19d13b98
    remote:错误:有关更多信息,请参阅http://git.io/iEPt8g。
    remote:error:文件路径/ to / My.framework / Versions / A / My是101.13 MB;
    超过GitHub的文件大小限制100.00 MB


  4. 我也删除了文件


.framework 并不总是那么大。它只是最近才变得> 100MB,所以它用来推动没有问题。这里有解决方案吗?

解决方案

当您推送时,您不仅仅推送一个提交,而是推送所有提交远程还没有。我认为你做了这样的事情。

  1。推/拉与遥控器同步。 
2.提交大文件。
3.删除大文件。
4.按。

现在您正在推送添加大文件的提交和删除它的提交。他们 必须被推送。



您可以使用 git log --stat origin来检查将要推送的内容/ master (假设远程是 origin ,分支是 master )。特别是,提交6b97634aa8b5de75e8affdcb19d13b98将是问题。



如果是这种情况,您必须从历史记录中删除大文件

但由于您遇到问题 两个 git-lfs 推,我认为这里还有其他事情要做。我怀疑还有另一个大文件丢失。也许你可以显示你的实际存储库?


I have a .framework file that is rather large and for some reason Git LFS is not working correctly for it, so I decided to ignore it so that it is not pushed.

  1. I added it to my .gitignore.
  2. I ran these 3 commands from Terminal

    git rm -r --cached .
    git add .
    git commit -m "fixed untracked files"
    

  3. I confirmed that the .framework is no longer being tracked.

  4. When I try to push the commit again, I still get the error that the file is too large.

    remote: error: GH001: Large files detected. You may want to try Git Large 
    File Storage - https://git-lfs.github.com.
    remote: error: Trace: 6b97634aa8b5de75e8affdcb19d13b98
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File path/to/My.framework/Versions/A/My is 101.13 MB;
    this exceeds GitHub's file size limit of 100.00 MB
    

  5. I also deleted the file entirely and it is still attempting to push it.

The .framework wasn't always so big. It only recently became >100MB so it used to push without a problem. Is there any solution here?

解决方案

When you push, you're not just pushing one commit, you're pushing all commits which the remote does not yet have. I think you did something like this.

1. Push/pull to be in sync with the remote.
2. Commit the large file.
3. Delete the large file.
4. Push.

Now you're pushing both the commit which added the large file and the commit which deleted it. They both have to be pushed.

You can check what's going to be pushed with git log --stat origin/master (assuming the remote is origin and the branch is master). In particular, commit 6b97634aa8b5de75e8affdcb19d13b98 will be the problem.

If this is the case, you will have to delete the large file from history.

But given that you're having trouble with both git-lfs and pushing, I think there's something else going on here. I suspect there's another large file you're missing. Perhaps you could show your actual repository?

这篇关于Git仍然试图推送被忽略和删除的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆