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

这篇具有很好参考价值的文章主要介绍了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
因此记录一下解决报错的方法。


一、创建项目仓库

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

二、创建工作区

1、在本地新建一个名字为 Centos 的文件夹
git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
2、进入到 Centos 目录,右键选择 Git Bash Here
git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
3、初始化本地库

git init

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

三、配置 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上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee

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

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

没有生成 SSH 公钥 git

解决办法:

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

配置完 SSH 公钥后再次上传属性文件即可成功
git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
Gitee 的项目仓库里面也有了上传的属性文件
git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,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"

git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
3、上传 Centos 镜像文件

git push origin master

git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
报错了,这里的错误信息主要有两个:

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

git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee
再次上传 Centos 镜像文件

git push origin master

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

已成功,再到 Gitee 项目仓库里看一下
git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”,Git,git,gitee


我的qq:2442391036,欢迎交流!文章来源地址https://www.toymoban.com/news/detail-524449.html


到了这里,关于git上传文件到Gitee报错“error: failed to push some refs to ‘https://gitee.com/xxxx”的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 解决error: failed to push some refs to ‘https://gitee.com/xxx.git‘

    在 git 执行命令git push origin master时候报错 error: failed to push some refs to \\\"https://gitee.com/xxx.git\\\" 根本原因是远程仓库和本地仓库内容不同,将远程仓库中不同的内容pull到本地,就好了。 解决方法: 将初始化文件同步到本地,然后再次执行 git push origin master

    2024年02月12日
    浏览(37)
  • git push报错error: failed to push some refs to

    环境:自建gitlab 问题:新建gitlab项目后,开发反馈不能push代码,报错\\\"error: failed to push some refs to\\\" git pull --rebase origin master git push -u origin master 依然报相同的错误。 现在再次上传,成功了。 新建gitlab项目,master分支默认是受保护的状态,使用比如说 dev 分支上传,再合并到m

    2024年02月14日
    浏览(50)
  • error: failed to push some refs to ‘https://gitee.com/xxx/practice.git‘

    error: failed to push some refs to \\\'https://gitee.com/xxx/practice.git\\\'  To https://gitee.com/xxx/practice.git hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing ! refs/heads/master:refs/heads/master [rejected] (fetch first) hint: to the same ref. You may want

    2024年02月03日
    浏览(26)
  • git push报错:error: failed to push some refs to ‘https:/

    根据提示,翻译是要合并的库和本地库不一致,要先执行git pull操作 在网上找了一些解决方案,都是执行如下指令 但是并没有解决我的问题,也没有一些更好的解决方案。 仔细思考了下,我要并入的并不是master这个主分支,而是我创建的一个新分支shuwwl_new_br 于是将上述指令

    2024年02月11日
    浏览(97)
  • 【git 报错】:git push 提示error:failed to push some refs to “xxxxxx“

    在git push操作提交一个文件到远程库的时候报错:error: failed to push some refs to ‘https://gitee.com/gitee-zhangchq/stm32.git’ 翻译: 错误:无法将某些引用推送到’https://gitee.com/gitee-zhangchq/stm32.git’ 由于这是一个在gitee上面新创建的一个远程库,然后在创建远程库的时候还选择了自动生

    2024年02月17日
    浏览(45)
  • git提交报错error: failed to push some refs to ‘git url‘

    想把本地仓库提交到远程仓库,报错信息如下 git提交报错信息 error: src refspec master does not match any error: failed to push some refs to \\\'git url\\\' 错误原因: 我们在创建仓库的时候,都会勾选“使用Reamdme文件初始化这个仓库”这个操作初识了一个README文件并配置添加了忽略文件。当点击创

    2024年01月22日
    浏览(37)
  • git push报错:![rejected] master -> master(non-fast-forward) error:failed to push some refs to XXX

    背景 本地git库,要push到gitlab上,执行完如下命令后报错: 报错信息为: 原因 从本地代码创建远程仓库的时候,添加了README.md,但本地仓库中并没有该文件。 解决方案 添加忽略不相干的历史选项,将远程仓库中的文件重新拉取到本地,这样本地文件会出现README.md: 之后再

    2024年02月04日
    浏览(48)
  • 已解决error: failed to push some refs to ‘https://gitee.com/

    已解决error: failed to push some refs to ‘https://gitee.com/ error: failed to push some refs to ‘https://gitee.com/ 对于该错误信息\\\"error: failed to push some refs to ‘https://gitee.com/详细解决方法’\\\",通常是由远程仓库已经发生了变化,与本地仓库冲突导致的。 下滑查看解决方法 拉取最新代码:在推送

    2024年02月08日
    浏览(31)
  • 如何解决error: failed to push some refs to ‘https://gitee.com/

    在使用git连接Gitee远程库进行第一次提交时,很多时候会下面的错误,这是由于远程库的文件和本地仓库的文件不一致  想要解决这个问题很简单,只需要进行以下操作: 1.先在git命令行执行下面的操作 这样做的作用是将远程库的文件同步到本地仓库 2. 再次执行 git push 命令

    2024年02月11日
    浏览(56)
  • git 提交出错:failed error: failed to push some refs to

    git push 时候出错:failed error: failed to push some refs to  这是因为远程和本地版本不一致导致的 解决办法: 1, git pull --rebase origin 分支名称 git pull --rebase 分支名称 :是将远程库中的更新合并到本地库中 rebase参数:取消本地更新内容的commit 并将本地更新接到远程更新合并之后,

    2024年02月08日
    浏览(44)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包