git上传文件到Gitee报错“error: failed to push some refs to https://gitee.com/xxxx”

简介: 我要将一个 4.27 GB 的文件上传到 Gitee 上,但是出现了下面这样的报错error: failed to push some refs to 'https://gitee.com/xxxx/centos.git因此记录一下解决报错的方法。

前言


我要将一个 4.27 GB 的文件上传到 Gitee 上,但是出现了下面这样的报错

error: failed to push some refs to 'https://gitee.com/xxxx/centos.git

因此记录一下解决报错的方法。


一、创建项目仓库


创建一个新的项目仓库,可以参考我之前写的博客Pycharm集成Gitee及使用,我这里新建了一个名字为 Centos 的仓库。


二、创建工作区


1、在本地新建一个名字为 Centos 的文件夹

2、进入到 Centos 目录,右键选择 Git Bash Here

3、初始化本地库

git init


三、配置 LFS


1、 开启 LFS


前面的博客中我有讲过 Git-LFS 的下载及安装,请参考使用 git push 上传超过100MB文件报错 remote: error: this exceeds GitHub‘s file size limit of 100.00 MB

git lfs install


2、将 CentOS-7-x86_64-DVD-1810.iso 文件移动到当前目录下并执行

git lfs track CentOS-7-x86_64-DVD-1810.iso

3、追踪需要上传的大文件

 git lfs track CentOS-7-x86_64-DVD-1810.iso

4、添加要上传的文件属性,(要先添加文件属性,不然有可能会失败)

git add .gitattributes

5、添加属性文件上传的说明

git commit -m "pre"

6、建立本地和 Gitee 仓库的链接(起个别名)

git remote add origin https://gitee.com/liupeng97/centos.git

7、上传属性文件

git push git@gitee.com:liupeng97/centos.git master

报错原因:

没有生成 SSH 公钥 git

解决办法:

参考我之前所写的博客 Github SSH免密登录

配置完 SSH 公钥后再次上传属性文件即可成功

Gitee 的项目仓库里面也有了上传的属性文件


四、上传镜像文件


1、添加要上传的 Centos 镜像文件

git add -f CentOS-7-x86_64-DVD-1810.iso

2、添加要上传的 Centos 镜像文件的说明

git commit -m " CentOS-7-x86_64-DVD-1810.iso"

3、上传 Centos 镜像文件

git push origin master

报错了,这里的错误信息主要有两个:

WARNING: Authentication error: Authentication required: LFS only supported repository in paid enterprise.
batch response: LFS only supported repository in paid enterprise.

解决方法:

①、第一个错误的解决方法:

git config lfs.https://gitee.com/{your_gitee}/{your_repo}.git/info/lfs.locksverify false

命令中的{your_gitee}/{your_repo}是你的远程仓库地址,根据自己情况替换。

以我的为例

git config lfs.https://gitee.com/xxxx/centos.git/info/lfs.locksverify false

②、第二个错误的解决方法:

删除./git/hooks/pre-push文件

rm .git/hooks/pre-push

再次上传 Centos 镜像文件

git push origin master

已成功,再到 Gitee 项目仓库里看一下


目录
相关文章
|
存储 安全 开发工具
Git安装与配置:操作步骤+Gitee绑定
本文系统介绍了Git从安装配置到远程协作的全流程,涵盖基础概念、常用命令、分支管理、冲突解决及Gitee实战操作,助你高效掌握代码版本控制与团队协作技巧。
1786 155
|
安全 开发工具 git
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
1056 5
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
|
算法 安全 网络安全
git clone操作报错diffie-hellman-group1-sha1的解决方案
在处理这一问题时,需要确保了解相关操作的安全影响。`diffie-hellman-group1-sha1`算法被认为是不够安全的,这是因为随着计算能力的提高,`SHA-1`算法可以在合理的时间内被破解,而且其对应的 `1024位`Diffie-Hellman组也可能不够强大。因此,在确保Git操作的同时,也要考虑提升安全性的长期解决办法。强烈推荐与管理员或相关技术支持团队合作,升级和加强服务器端的安全配置。
454 12
|
开发工具 git 索引
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
408 21
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
|
Shell 开发工具 git
解决git bash报错:在仓库中检测到可疑的所有权
总的来说,解决“在仓库中检测到可疑的所有权”的报错,关键在于理解和调整文件或目录的所有权。只要我们正确地设置了文件或目录的所有权,那么我们就可以避免这种问题,让Git Bash正常工作。
972 22
|
网络协议 开发工具 git
解决 git 报错 “fatal: unable to access ‘https://github.com/.../.git‘: Recv failure Connection was rese
在使用 Git/Git小乌龟 进行代码管理的过程中,经常会遇到各种各样的问题,其中之一就是在执行 git clone 或 git pull 等操作时出现 “fatal: unable to access ‘https://github.com/…/.git’: Recv failure Connection was reset” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
11222 1
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
1350 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
安全 Shell 开发工具
Windows下使用git配置gitee远程仓库
就在前几天因为一些原因,我的电脑重装了系统,然后再重新配置git的环境的时候就遇到了一些小问题。所以我决定自己写一篇文章,以便以后再配置git时,避免一些错误操作,而导致全网搜方法,找对的文章去找对应的解决方法。下面为了演示方便就拿gitee来演示,不拿GitHub了写文章了。
820 0
|
安全 网络协议 Linux
Linux网络应用层协议展示:HTTP与HTTPS
此外,必须注意,从HTTP迁移到HTTPS是一项重要且必要的任务,因为这不仅关乎用户信息的安全,也有利于你的网站评级和粉丝的信心。在网络世界中,信息的安全就是一切,选择HTTPS,让您的网站更加安全,使您的用户满意,也使您感到满意。
623 19
|
网络安全 开发者
如何解决HTTPS协议在WordPress升级后对网站不兼容的问题
以上就是解决WordPress升级后HTTPS协议对网站的不兼容问题的方法。希望能把这个棘手的问题看成是学校的管理问题一样来应对,将复杂的技术问题变得更加有趣和形象,并寻觅出解决问题的方式。希望你的网站能在新的学期得到更好的发展!
499 19