error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

git首次提交代码到远程仓库提示413错误,错误信息如下

git push --set-upstream origin master
Enumerating objects: 153, done.
Counting objects: 100% (153/153), done.
Delta compression using up to 4 threads
Compressing objects: 100% (133/133), done.
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
fatal: the remote end hung up unexpectedly
Writing objects: 100% (153/153), 30.44 MiB | 8.93 MiB/s, done.
Total 153 (delta 9), reused 0 (delta 0)
fatal: the remote end hung up unexpectedly
Everything up-to-date

 

踩坑记 

百度上很多文章的解决办法是换成ssh协议,来连接远程仓库。这也是没办法的办法,不优雅,不是作为一个技术人妥协的借口。

 

错误原因

http的413错误码是请求体太大,那自然是服务器配置问题

由于我服务端是用nginx反向代理的,所以首先去改nginx配置

在http 的 server 节点中添加client_max_body_size配置如:

 

解决步骤

找到nginx配置文件 nginx.conf

find / -name nginx.conf

修改配置 

http {
  server {
    client_max_body_size 100m
    #其他配置
  }
  # 其他配置
}

重载配置,使其生效

nginx -s reload
发布了283 篇原创文章 · 获赞 258 · 访问量 121万+

猜你喜欢

转载自blog.csdn.net/meimeieee/article/details/105142277