首页 > 其他分享 >git push 报错 ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push so

git push 报错 ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push so

时间:2024-01-21 11:34:43浏览次数:25  
标签:git remote 报错 error push main

今天在用git push项目的时候,出现了一个报错,记录一下解决方案,以后报同样的错误可以回来看。

错误

下面是git push的详细报错信息:

20866@DESKTOP-7R0VL04 MINGW64 /d/AllProjects/JupyterProjects (main)
$ git push origin main
Enumerating objects: 152, done.
Counting objects: 100% (152/152), done.
Delta compression using up to 8 threads
Compressing objects: 100% (147/147), done.
Writing objects: 100% (152/152), 1.45 GiB | 3.57 MiB/s, done.
Total 152 (delta 19), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (19/19), done.
remote: error: Trace: 33c674f670a5be28e672de71fddd6350a7b7bb12f12e9ee5727cb7193071e41b
remote: error: See https://gh.io/lfs for more information.
remote: error: File Recommender Sysytem/music_data.tsv is 2412.03 MB; this exceeds GitHub's file size limit of 100.0
remote: error: File Recommender Sysytem/track_metadata.db is 711.61 MB; this exceeds GitHub's file size limit of 100
remote: error: File Recommender Sysytem/train_triplets.txt is 2862.61 MB; this exceeds GitHub's file size limit of 1
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/wephiles/jupyterProjects.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/wephiles/jupyterProjects.git'

如图所示:
image

查看报错信息:

错误信息提示我们,出错的原因是因为单个文件大小超出了github的最大文件大小100M;

remote: error: File Recommender Sysytem/music_data.tsv is 2412.03 MB; this exceeds GitHub's file size limit of 100.0

解决方法

根据报错信息的提示,git提示我们去https://git-lfs.github.com查看传输大文件的方法。

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com

我们打开这个网址,看到下面这样的页面:

image

文件详细介绍了如何传输大文件:
image

  • 首先安装下载并初始化:git lfs install,如果你以前没用过这个扩展,那么你需要使用这个命令;如果你已经用过了,你可以跳过这个步骤;

  • 使用命令 git lfs track "这里面写你的文件名称",如果有多个大文件,把每个文件都是用同样的方法操作就可;
    image

  • 使用命令 git add .gitattributes
    image

  • 接下来就是常用的步骤,将文件push上去即可

    git add "这里写你的文件名称"
    git commit -m "这里写你的提交信息"
    git push origin main
    

提交完成后就可以愉快地传大文件到github了:

image

我的提交又报错了,根据提示,文件的大小要小于等于2GB,那只能把这个大文件删除了,在上传剩下的文件了。
image

我们删除两个大文件后,成功push!
image

标签:git,remote,报错,error,push,main
From: https://www.cnblogs.com/wephiles/p/17977554

相关文章

  • git切分支引起的重编译问题
    实际使用git管理一个大型项目时,如llvm,当仅修改极少量的代码,切换分支后会引起很多代码的重新构建。特别是切换到老的分支上,老的build目录里应该不需要重新编译才对。由此引发一个问题:gitcheckout切换分支之后,源码的日期会变化吗?假如A,B分支中都有源文件fun.c,A中比B中新,当前在A......
  • 将 .NET 8应用 以 dotnet publish 创建容器镜像并结合 Github Actions 部署到 Azure
    介绍.NET8无需DockerFile即可为.NET应用创建docker映像的新方法,我将使用dotnetpublish将.NET应用容器化,在本文中,我将分享我如何为.NET8的项目创建一个简单的ci/cd的经验。它包括2个主题:创建用于生成.NET应用并将其发布到Azure的GitHub工作流如何使用do......
  • git上传代码指令,拿来即用
    进入到所要上传的项目中打开git输入如下指令即可上传成功,地址换成你们的就行,由于git仓库勾选了README.md但是本地仓库没有所以需要下拉远程仓库并且合并操作,感谢wayup的文章gitinitgitadd.gitcommit-m“firstcommit”gitbranch-Mmaingitremoteaddoriginhttps://......
  • Mac安装Git
    官网https://git-scm.com/download/macbrew安装gitbrewinstallgit配置git设置Git用户名和电子邮件:#设置你的用户名gitconfig--globaluser.name"你的用户名"#设置你的电子邮件地址gitconfig--globaluser.email"你的电子邮件地址"#检查配置gitconfig--lis......
  • node-sass 安装出错 Cannot download "https://github.com/sass/node-sass...
    Downloadingbinaryfromhttps://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.nodeCannotdownload"https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node": github网站大多时候都访问不到,下载 win32-x......
  • Git必知必会基础(12):忽略文件
     本系列汇总,请查看这里:https://www.cnblogs.com/uncleyong/p/10854115.html 应用场景可以在git仓库的根目录下添加—个名为.gitignore的文件,用于指定需要被git忽略的文件或文件夹应用场景:1.减少远程仓库大小占用,有些不需要push到远程仓库的内容就可以忽略2.涉及......
  • Git必知必会基础(11):撤销操作
     本系列汇总,请查看这里:https://www.cnblogs.com/uncleyong/p/10854115.html数据准备 说明:下面对file的操作,都可以用通配符gitadd<file>...比如:gitadd*.txt gitrestore<file>...比如:gitrestore--staged*.txt 修改文件(已提交过,文件已在本地仓库中)撤销:对......
  • 【github】Mac系统中,如何项目clone(1.通过vscode链接github,2.进行clone)
     1.通过vscode打开一个空文件夹(目录:确认想要放置新项目的目录)2.进行vscode和github的链接1)参考下方网址1-6步,生成sshkey,登录到github,检测SSHkeyhttps://cloud.tencent.com/developer/article/1952247,网址中有效内容如下:1.检查SSHkey是否存在在Mac终端输入:ls-a~/.......
  • Git Rebase和Merge-cnblog
    GitRebase和MergeRebase首先,先看一下gitrebase的操作图:在B点创建出来一个新的分支feature,进行了两个commitC和D,master分支则进行了一次提交M,然后在feature分支上执行然后执行gitrebasemaster这样对变基(rebase)既可清楚理解。gitrebase简单来说就是将C和D的提交抽取......
  • 初次使用git
    1.在gitee新建仓库2.在本地文件夹下初始化仓库:gitinit3.提交所有文件到缓冲区:gitadd.4.提交缓冲区文件到本地仓库:gitcommit-m"initialcode"5.关联本地仓库与远程仓库:gitremoteaddorigingitee仓库地址第6到10步为错误命令。6.gitpulloriginmaster提示有偏离......