【问题标题】:problem pushing changes to GitHub because of file that's not really there由于文件不存在而将更改推送到 GitHub 的问题
【发布时间】:2019-12-02 22:09:37
【问题描述】:

我一直在尝试将更改推送到我的 GitHub 存储库,但遇到了这个问题:

Uploading LFS objects: 100% (164/164), 153 MB | 0 B/s, done.                    
Enumerating objects: 25977, done.
Counting objects: 100% (25968/25968), done.
Delta compression using up to 4 threads
Compressing objects: 100% (18133/18133), done.
Writing objects: 100% (25955/25955), 146.83 MiB | 232.00 KiB/s, done.
Total 25955 (delta 6561), reused 25816 (delta 6463)
remote: Resolving deltas: 100% (6561/6561), completed with 4 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: 9f797e9b5f7a1c01fca6706ad62e21ba
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so is 225.31 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/yovelcohen/nba-stats.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/yovelcohen/nba-stats.git'
(base) yovel@the-beastpad:~$ cd venv/lib/python3.6/site-packages/tensorflow_core/python/

bash: cd: venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so: No such file or directory

我将 TensorFlow 导入项目,但随后将其删除,当尝试从终端删除它时它不存在(并且在手动查找时)。

任何帮助将不胜感激!

【问题讨论】:

  • git status 说什么?
  • 如果您已经提交了大文件,请尝试提交删除操作并再次推送
  • ``` (base) yovel@:~/PycharmProjects/nba_stats$ git restore venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so 错误:pathspec 'venv/ lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so' 与 git ``` 已知的任何文件都不匹配
  • 只是为了澄清一下,您是否在本地将其删除但它仍在您的 git 存储库中?还是反过来?
  • @yovelcohen 我建议将 .gitignore 文件添加到您的存储库中。您可以使用此示例:github.com/github/gitignore/blob/master/Python.gitignore

标签: python github push


【解决方案1】:

既然你不应该推送任何生成的二进制文件,首先从本地删除它们,提交并推送:

 git rm -r '*.so' -f
 echo '*.so' >> .gitignore

但如果仍然失败,则意味着您正在尝试使用 *.so 文件推送过去的提交(不仅仅是最新的提交),即使最后一次提交不再包含任何此类文件。

如果是这种情况,由于git filter-branch is soon deprecated,请考虑newren/git-filter-repo 在推送之前删除任何像*.so 这样的大文件(或强制推送会重写之前推送的过去提交的内容)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 2020-02-05
    • 2021-12-21
    • 2019-07-01
    • 2021-05-31
    相关资源
    最近更新 更多