git推送到远程仓库报错: File park/xxx is xxx MB; this exceeds GitHub's file size l imit of 100.00 MB
- 错误还原
ychen@DESKTOP-49HGBQ1 MINGW64 /c/work/git/machine_vision (main)
$ git push
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 16 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 97.15 MiB | 3.11 MiB/s, done.
Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: error: Trace: 521dfe2e913d8cf6ed8bdc0a3a3b66d7dc91ab45cf6ee87ded28236e2f745ddd
remote: error: See https://gh.io/lfs for more information.
remote: error: File park/car1.h5 is 105.73 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/dogleftover/machine_vision.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/dogleftover/machine_vision.git'
-
错误原因:推送的单个文件不能超过100MB
-
解决方案:版本回退后,压缩该文件是否超过100MB,如果还是超过就不要提交,否则之后的内容也推送不上去了
# 查看提交记录
ychen@DESKTOP-49HGBQ1 MINGW64 /c/work/git/machine_vision (main)
$ git log
commit 112c08cd9a36e7e581dd1cae436b6a6344157724 (HEAD -> main)
Author: dogleftover <dogleftover@qq.com>
Date: Tue Mar 5 11:26:45 2024 +0800
1
commit 148ae939daf3603b404141efa5bbf9e6e997cf00 (origin/main, origin/HEAD)
Author: dogleftover <dogleftover@qq.com>
Date: Tue Mar 5 11:21:42 2024 +0800
README
# 退出查看历史记录
q
# 回退到前一个版本,暂存区和工作区的内容会被清空
ychen@DESKTOP-49HGBQ1 MINGW64 /c/work/git/machine_vision (main)
$ git reset --hard 148ae939daf3603b404141efa5bbf9e6e997cf00
HEAD is now at 148ae93 README
# 查看是否回退成功
ychen@DESKTOP-49HGBQ1 MINGW64 /c/work/git/machine_vision (main)
$ git log
commit 148ae939daf3603b404141efa5bbf9e6e997cf00 (HEAD -> main, origin/main, origin/HEAD)
Author: dogleftover <dogleftover@qq.com>
Date: Tue Mar 5 11:21:42 2024 +0800
README