首页 > 解决方案 > 安装 Git LFS - master 后(预接收挂钩被拒绝)

问题描述

我知道这个问题出现了很多,为此道歉......但我已经阅读了 StackOverflow 上的许多条目,但我无法让它们中的任何一个起作用。所以又来了,希望能得到一些指导...

背景:我一个人在一个项目中工作。我一直在 GitHub 上有我的 repo,它一直运行良好。基本上我从主人那里推拉都没有任何问题。这次我有一个 +173MB 的大文件,所以我决定尝试总是弹出的 Git 大文件存储。我遵循的过程是它在网站上所说的:

brew install git-lfs
git lfs install
git lfs track "*.csv" (my file is a csv)
git add .gitattributes

这样做之后,我无法再推送给主人了。消息是:

(venv-MBTI) (base) diego@DIGL Capstone 2 - MBTI % git push origin master
Uploading LFS objects: 100% (1/1), 345 B | 0 B/s, done.
Enumerating objects: 146, done.
Counting objects: 100% (135/135), done.
Delta compression using up to 4 threads
Compressing objects: 100% (116/116), done.
Writing objects: 100% (120/120), 59.90 MiB | 634.00 KiB/s, done.
Total 120 (delta 25), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (25/25), completed with 7 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: cb2e700c19f2bdbb2ca9aeb2df53605a
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File data/mbti_interim is 173.20 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/DSJourney/MBTI.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/DSJourney/MBTI.git'

我尝试了在 StackOverflow 中找到的大部分内容:

git pull --rebase
git reset --soft HEAD~1
git revert a2f2db2 (an older commit)
git push -u origin master

我也试着跟随

其他不太相关的东西

我想我做错了什么,但一直无法弄清楚。

有什么建议吗?

标签: gitgithubhookwebhooksgit-lfs

解决方案


提出了两种解决方案,ElpieKay 提出了正确的一种:

  1. 备份data/mbti_interim。如果它有很多版本,只需将本地存储库克隆到另一个路径。
  2. data/mbti_interim从历史记录中删除(链接
  3. 用于git lfs跟踪data/mbti_interim

我没有看到那个答案,所以我的解决方案是完全删除 GitHub 存储库并开始一个没有该文件的新存储库。


推荐阅读