一、概述

使用git push origin master时报错如下:

Push failed
Enumerating objects: 140, done.
Delta compression using up to 4 threads
Total 136 (delta 8), reused 84 (delta 3)
the remote end hung up unexpectedly
the remote end hung up unexpectedly
RPC failed; HTTP 413 curl 22 The requested URL returned error: 413

二、解决方式

查阅资料说是推送的文件太大,要么是缓存不够,要么是网络不行,要么墙的原因,我这里可能是网络的原因,因为我使用的是HTTPS的方式提交代码的,当我改成SSH的方式提交代码就解决了这个问题。如果是其他情况可以查看这篇文章git 推送出现 "fatal: The remote end hung up unexpectedly" 解决方案

如何将HTTPS提交的方式改为SSH的提交方式

首先需要添加SSH key到你的github仓库
生成新的SSH秘钥:ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
查看生成的公钥:cat ~/.ssh/id_rsa.pub
将生成的SSH公钥添加到github仓库

查看git 远程仓库的地址:git remote get-url origin 这是https的方式提交的
在这里插入图片描述
修改为SSH的提交方式:git remote set-url origin git@github.com:wangedison/vue-element-admin.git

再次查看git仓库地址:git remote get-url origin
在这里插入图片描述
下面列出了git-remote的使用文档
在这里插入图片描述

参考文章
https://www.cnblogs.com/lihaiping/p/6021813.html

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐