GH001:检测到大文件 - 删除大文件并尝试保存最近的工作

时间:2017-03-31 19:39:58

标签: git github large-files

我已经阅读了其他一些与这个问题相关的线程,每个人似乎只是回到'git reset --hard'...我试图避免,因为我会在错误开始之间失去工作,尝试还原提交,并删除大文件。

基本上,这是我的一系列事件:

  1. 尝试提交LARGE文件(100mb)
  2. 收到错误:GH001:检测到大文件。您可能想尝试Git Large File Storage
  3. 删除了桌面上的大文件。
  4. 继续在同一分支机构工作,并进行了多次文件更改。
  5. 提交的更改,收到相同的错误:GH001:检测到大文件。您可能想尝试Git Large File Storage
  6. $ git rm -cached large_filename.ext
  7. 收到错误:致命:pathspec'large_filename.ext'与任何文件都不匹配
  8. 还原原始提交大文件
  9. 尝试提交更改
  10. 相同错误:GH001:检测到大文件。您可能想尝试Git Large File Storage
  11. 我想要完成的任务(最佳案例场景):

    1. 从我的缓存中删除此大文件,而不会丢失我在HEAD中的当前工作
    2. 仅提交我的HEAD中的最近更改(当然没有大文件)
    3. MY ERROR:来自$ git push

      Counting objects: 57, done.
      Delta compression using up to 8 threads.
      Compressing objects: 100% (53/53), done.
      Writing objects: 100% (57/57), 74.03 MiB | 447.00 KiB/s, done.
      Total 57 (delta 24), reused 0 (delta 0)
      remote: Resolving deltas: 100% (24/24), completed with 13 local objects.
      remote: error: GH001: Large files detected. You may want to try Git Large File Storage 
      remote: error: Trace: #####
      remote: error: See http-git.io/iEPt8g for more information.
      remote: error: File large_filename.ext is 104.47 MB; this exceeds GitHub's file size limit of 100.00 MB
      To http-PROJECTNAME.git
      ! [remote rejected] master -> master (pre-receive hook declined)
      error: failed to push some refs to 'http-PROJECTNAME.git'
      $ git rm --cached large_filename.ext
      fatal: pathspec 'large_filename.ext' did not match any files
      

      我的问题的视觉表示:

      Github vs My Git Client

      更新20170303:

      @Edmundo感谢有用的信息让我走到这一步。我想我越来越近了。我创建了一个新的分支,删除了缓存的文件,修改了,然后尝试挑选它,它不会让我合并,因为未跟踪的工作树文件将被覆盖(这很奇怪,因为我以为我删除了它们)。 / p>

      $ git branch gj-removehero ###6d9dc0e3983968a012ec22795dd69f7######
      $ git checkout gj-removehero
      Switched to branch 'gj-removehero'
      $ git rm --cache assets/theme/img/hero-ideas/shutterstock_276636890.*
      rm 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg'
      rm 'assets/theme/img/hero-ideas/shutterstock_276636890.psd'
      $ git commit --amend --no-edit
      [gj-removehero b7e320b] hero options
       Date: Fri Mar 31 09:40:19 2017 -0400
       16 files changed, 0 insertions(+), 0 deletions(-)
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-393187381.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-192138551.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-374766055.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-127556570.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-579102199.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-223736014.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-379532248.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-226122967.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-229092871.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-567904627.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-224715364.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-439437442.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-283528433.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-582564463.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock-528930796.jpg
       create mode 100644 assets/theme/img/theme-hero-05.jpg
      
      $ git cherry-pick ###6d9dc0e3983968a012ec22795dd69f7######
      error: The following untracked working tree files would be overwritten by merge:
              assets/theme/img/hero-ideas/shutterstock_276636890.jpg
              assets/theme/img/hero-ideas/shutterstock_276636890.psd
      Please move or remove them before you can merge.
      Aborting
      $ git rm assets/theme/img/hero-ideas/shutterstock_276636890.*
      fatal: pathspec 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg' did not match any files
      $ git cherry-pick ###6d9dc0e3983968a012ec22795dd69f7######
      [gj-removehero 0c808b5] hero options
       Date: Fri Mar 31 09:40:19 2017 -0400
       2 files changed, 0 insertions(+), 0 deletions(-)
       create mode 100755 assets/theme/img/hero-ideas/shutterstock_276636890.jpg
       create mode 100644 assets/theme/img/hero-ideas/shutterstock_276636890.psd
      $ git rm --cache assets/theme/img/hero-ideas/shutterstock_276636890.*
      rm 'assets/theme/img/hero-ideas/shutterstock_276636890.jpg'
      rm 'assets/theme/img/hero-ideas/shutterstock_276636890.psd'
      $ git commit --amend --no-edit
      On branch gj-removehero
      Untracked files:
              assets/theme/img/hero-ideas/shutterstock_276636890.jpg
              assets/theme/img/hero-ideas/shutterstock_276636890.psd
      
      No changes
      You asked to amend the most recent commit, but doing so would make
      it empty. You can repeat your command with --allow-empty, or you can
      remove the commit entirely with "git reset HEAD^".
      

0 个答案:

没有答案