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 项目仓库里看一下


目录
相关文章
|
8天前
|
开发工具 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 报错如何解决-优雅草卓伊凡
25 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
27天前
|
关系型数据库 MySQL Docker
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
|
2月前
|
Ubuntu Linux Shell
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
(已成功解决)Linux环境报错—bash: wget: command not found;常见Linux发行版本,Linux中yum、rpm、apt-get、wget的区别;Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
486 68
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
|
3月前
|
存储 网络安全
Curl error (60): SSL peer certificate or SSH remote key was not OK for https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/base/x86_64/repodata/repomd.xml [SSL: no alternative certificate subject name matches target host name 'update.cs2c.com.cn']
【10月更文挑战第30天】在尝试从麒麟软件仓库(ks10-adv-os)下载元数据时,遇到 SSL 证书验证问题。错误提示为:`Curl error (60): SSL peer certificate or SSH remote key was not OK`。可能原因包括证书不被信任、证书与域名不匹配或网络问题。解决方法包括检查网络连接、导入 SSL 证书、禁用 SSL 证书验证(不推荐)、联系仓库管理员、检查系统时间和尝试其他镜像。
804 1
|
3月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
299 1
|
4月前
|
存储 开发工具 数据安全/隐私保护
git报错The project you were looking for could not be found 解决方式
git报错The project you were looking for could not be found 解决方式
978 1
|
4月前
|
编译器 网络安全 开发工具
git学习五:切换本地仓库出现的问题。修改git配置初始化。error:src refspec master does not match any。错误总结,送上几个案例
这篇文章是关于Git使用中遇到的一些问题及其解决方案的总结,包括切换本地仓库时的问题、修改Git初始化配置、以及解决"error: src refspec master does not match any"错误等。
136 0
|
4月前
|
资源调度 编译器 Linux
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx
125 0
|
5月前
|
开发工具 git 索引
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
|
5月前
|
存储 Shell 开发工具
8-8|windows上Git报错
8-8|windows上Git报错